moving GnuCash from CVS to SVN using cvs2svn.py

I was responsible for moving the GnuCash CVS repository over to Subversion, which was an interesting experience.

The basics are covered in all the applicable documentation, though there’s are some things I distilled out, primarily around cvs2svn.

cvs2svn is seperately available from http://cvs2svn.tigris.org/ but has not-quite-direct docs about how to do what I’d imagine is a pretty straightforward thing: dump multiple CVS modules into seperate top-level SVN directories following the recommended “module/{trunk,branches,tags}/” convention. It turns out, from the cvs2svn FAQ, the incantations are:

  • ~/cvs2svn-1.3.0/cvs2svn [options below] --dump-only --dumpfile=moduleA.dump /path/to/cvs/repo/moduleA
  • svn mkdir file:///path/to/svn/repo/moduleA
  • svnadmin --parent-dir moduleA load /path/to/svn/repo < moduleA.dump

There were two sets of options that we needed to add: the first around symbol renaming, and the second dealing with binary files.

The list of symbol transform arguments to cvs2svn to do branch- and tag-renaming was:

–symbol-transform=’gnucash-([0-9]+)-([0-9]+)-branch:\1.\2′ –symbol-transform=’gnucash-docs-([0-9]+)-([0-9]+)-branch:\1.\2′ –symbol-transform=’gnucash-([0-9]+)-([0-9]+)-([0-9]+)-rc:\1.\2.\3-rc’ –symbol-transform=’gnucash-([0-9]+)-([0-9]+)-([0-9]+[a-z]+?):\1.\2.\3′ –symbol-transform=’gnucash-([0-9]+)-([0-9]+)-(.*):\1.\2.\3′ –symbol-transform=’gnucash-docs-([0-9]+)-([0-9]+)-([0-9]+):\1.\2.\3′ –symbol-transform=’root-of-gnucash-([0-9]+)-([0-9]+):\1.\2-root’

Turns out some of the historical CVS gnucash files aren’t appropriately tagged binary, and for some reason cvs2svn or svn itself wasn’t really doing the right thing. As such, I needed to override the mime-types and eol-handling with the options:

–no-default-eol –eol-from-mime-type –mime-types=/root/test.mime.types

It turns out that you just have to use all these options together, basically. /root/test.mime.types was cobbled together by grepping the image/* types out from the normal mime.types, then extending the application/octet-stream entry for some gnucash-specific extensions. Specifically:

application/octet-stream bin dms lha lzh exe class so dll xac gmo

Apart from that, cvs2svn does all the work, here. After running the svnadmin import, the dumpfile for moduleA will be imported into the directory ‘moduleA’ in the SVN repo, and Bob’s your uncle.

Comments are closed.