ASCIIMath creating images

Tuesday, January 18, 2011

Further adventures with Mercurial: Converting a repository from Subversion

I have been using Mercurial for a little while now, and have become accustomed enough to try converting my rather large Subversion repository I have sitting on my home server.  This has proven to be a bit challenging.

Mercurial tracks files only, not directories - it does track the location of files, but it is not possible to have an empty directory in a Mercurial repository (I have taken to creating empty hidden files as a workaround).  Apparently this causes problems for some of the conversion/interaction tools, such hgsvn.

After several tries of various things, I've had success with hgsubversion python extension.  However, installing in under Ubuntu (10.10, or Maverick Meerkat) is not completely trivial. Here is what's needed to make it work:

  1. To build a version of subvertpy newer than what's in the repository, install libsvn-dev and python-dev: sudo apt-get install libsvn-dev python-dev
  2. Download subvertpy from http://samba.org/~jelmer/subvertpy/, then build and install it locally. You need at least 0.7.4 (Ubuntu's repositories have 0.7.3).
  3. Finally, follow the instructions on http://mercurial.selenic.com/wiki/HgSubversion to install hgsubversion.  I moved it into /usr/local/lib.
Then, a new Mercurial repository can be cloned with (for example) hg clone svn+ssh://myhost.org/myrepo.  Although the HgSubversion site warns about memory leaks, I found this procedure quite well.