Friday, February 29, 2008

Setting up Subversion to Mecurial conversion on Mac OS X 10.4.11 take 2

My first attempt at this was the hard way. The easier way is to use MacPorts:

$sudo port install subversion subversion-python24bindings

Unfortunately though, I still get the same errors as in my first attempt, when trying to convert the same Subversion repositories.

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.

Installing Mercurial on Tiger

Thought I would jot down my experiences installing Mercurial on a Mac running Tiger. Mac’s are great for some things, but they can be a bit of a pain when it comes to installing unix open source software.

The first thing I tried was installing the latest binary package from the Mercurial site. It is dependent on python, so first I installed MacPython 2.5 by following the link on the Mercurial Page. Then I tried installing the Mercurial binary package, but it complained because it couldn’t find Apple Python. Tried rebooting, didn’t work, go figure.

The second thing I tried was building from source. This is my preferred way of installing this kind of software, because you can explicitly manage the versions yourself. However the build failed because I didn’t have the documentation tools installed (these can be installed via MacPorts). Also, I didn’t seem to have my python path set up properly, because the built hg executable barfed with an error.

The third way I tried was installing via MacPorts. This worked very easily, once MacPorts was installed. The current version of MacPorts required a newer version of Xcode tools than what was already installed. So it was off to the apple developer site (I already had a login) to download the latest version, which is about 1GB.

IMHO, to have to sign up to an Apple site to get the current C compiler so you can build open source software is really poor form from Apple.

Why?

Well I am finally starting a blog.

I guess I am doing it now because I am currently evaluating distributed version control systems and wish to record my thoughts and experiences somewhere for future reference and the off chance that they may be useful for someone else.