Monday, March 17, 2008

Converting Subversion repository to Mercurial with tailor (Ubuntu 7.10)

I'm looking at managing our local builds in a better way than a set of patches against a point on the Sakai tree. Currently I am looking at placing a copy of the sakai subversion repository into a mercurial one. Mercurial doesn't seem to have good subversion support out of the box (unlike git) but the suggested route seems to be to use a genral purpose tool called tailor. Subversion, mercurial and tailor are packaged for Ubuntu (7.10) so after installing them I attempted a quick conversion of part of the Sakai repository.

To do this I generated a tailor configuration file with a command similar to:
tailor --verbose --source-kind svn --repository https://source.sakaiproject.org/svn/ --module portal --target-kind hg > sakai.tailor
and then attempted to run the conversion with:
tailor -c sakai.tailor
which failed with a nice python stack trace:
File "/var/lib/python-support/python2.4/vcpx/repository/hg.py", line 438, in _prepareWorkingDirectory
message = 'Tailor preparing to convert repo by adding .hgignore')
File "/var/lib/python-support/python2.4/vcpx/repository/hg.py", line 339, in _hgCommand allopts = self._defaultOpts(cmd)
File "/var/lib/python-support/python2.4/vcpx/repository/hg.py", line 333, in _defaultOpts findcmd = commands.find
AttributeError: 'module' object has no attribute 'find'

after a little puzzling I found a bug report about this "not compatible with mercurial 0.9.4", which contained a small patch to fix the issue. Applying this patch to my local machine allowed tailor to run fine. It seems that Ubuntu 8.04 (which will be released in a month) contains a later version of tailor so people shouldn't see this issue.

2 comments:

Anonymous said...

...Interesting. I've been tempted to try a Bazaar import, but haven't found the time to play around yet. I've seen the debate: bzr, darcs, hg, monotone -- take your pick -- but I'll be curious to see how any of them like our SVN structure. I'm particuarly wondering if the merge benefits and federation would do us well.

Matthew Buckett said...

I'd had a little time away from proper IP connectivity so tried out mercurial for managing my changes to a local project and liked it. The reason I picked mercurial were good documentation, cross platform, reasonably fast and very similar to SVN. I'm not sure it's the best one out of the distributed VCS choices but it worked for me.

I am keen to use it for managing our local deployment as mercurial remembers what changes have previously been merged into a branch (unlike SVN 1.4, although 1.5 attempts to fix this).