Thursday, February 28, 2008

Setting up Subversion to Mecurial conversion on Mac OS X 10.4.11

If I am to switch over to Mercurial, I need to be able to import my existing projects that are in Subversion. Mercurial includes a Convert extension for this purpose, so I thought I would try and get it going on my Mac.

[EDIT: This is the hard way. See this post, for the easy way.]

I already had Subversion 1.4.3 installed (compiled from source), but didn't have the Python bindings installed, so I used this article and the instructions in the file  subversion/bindings/swig/INSTALL, located in the Subversion source.

I thought I should build against the same version of Python as Mercurial was using. As I had installed Mercurial from MacPorts, Python 2.4 was located under /opt/local/.  This meant my configure statements were as follows.

swig:
$./configure --with-python=/opt/local/bin/python2.4

Subversion:
$./configure --prefix=/usr/local --with-openssl --with-ssl --with-zlib --enable-swig-bindings=python PYTHON=/opt/local/bin/python2.4

The bindings need to be in the python path, so I also created the file:
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/subversion.pth

with the contents:
$ cat subversion.pth
/usr/local/lib/svn-python


To confirm the bindings are installed correctly, the following command should execute with no output:
$/opt/local/bin/python2.4 -c "from svn import client"

I am not particularly happy with this installation. Compiling source that depends on a port makes me feel uncomfortable. Perhaps it is because I am unfamiliar with MacPorts or just the fact that I have to remember that this dependency exists and not to do anything that may affect it. I also installed swig 1.3.33 (the latest), however the Subversion docs only refer up to version 1.3.29.

So far I have been unable to successfully complete a conversion of a Subversion repository. Trying the example from the Mercurial docs starts working, but after a little while fails:
$ hg convert http://code.sixapart.com/svn/memcached
assuming destination memcached-hg
initializing destination memcached-hg repository
scanning source...
sorting...
converting...
710 Fix for flush_all 1-second window bug. You can now do a "set" immediately
...
698 cleanup, cleanup, cleanup, cleanup.
** unknown exception encountered, details follow
** report bug details to http://www.selenic.com/mercurial/bts
** or mercurial@selenic.com
** Mercurial Distributed SCM (version 0.9.5)
Traceback (most recent call last):
File "/opt/local/bin/hg", line 14, in ?
mercurial.dispatch.run()
...
File "/usr/local/lib/svn-python/libsvn/ra.py", line 511, in svn_ra_check_path
return apply(_ra.svn_ra_check_path, args)
libsvn._core.SubversionException: ("PROPFIND request failed on '/branches/client-xs-20070328/Cache-Memcached-GetParserXS/const-c.inc'", 175002)


Also tried converting one of the work Subversion repositories. It starts working, but after a little while fails with a different error:
** unknown exception encountered, details follow
** report bug details to http://www.selenic.com/mercurial/bts
** or mercurial@selenic.com
** Mercurial Distributed SCM (version 0.9.5)
Traceback (most recent call last):
File "/opt/local/bin/hg", line 14, in ?
mercurial.dispatch.run()
...
File "/opt/local/lib/python2.4/site-packages/hgext/convert/__init__.py", line 267, in convert
if "\n" in desc:
TypeError: iterable argument required


Haven't tried converting a local Subversion repository yet.

No comments: