Wednesday, March 19, 2008

tailor for svn to hg

Well after attempting to convert the portal part of the sakai subversion repository to mercurial I have discovered that tailor (the tool I used) doesn't understand svn tags and branches (or doesn't convert them to mercurial tags and branches). So although is seems to have converted the portal ok. I now have a huge checkout:

buckett@oucs-matthewb:~/tmp/portal $ du -sh *
228M    branches
4.0K    project.log
739M    tags
23M     trunk

So I think tailor would well for converting a branch (eg 2.5-x) or trunk but not for keeping details about when those branches were made from trunk.

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.