2007-09-27

git-svn doesn't allow for compiling a fresh Python checkout

Always being one willing to try new ways of making my coding life easier, I looked into svn support by Mercurial, Bazaar, and git (didn't look at svk as I don't like the whole depot thing). Since hgsvn doesn't support a way to push changes back to the svn repository and bzr-svn requires running against svn 1.5 which is not even released, I decided to try out git-svn.

So finding consistent instructions on how to use git-svn was a slight pain. Everyone used different commands and didn't always flat-out state what each step was doing. But after some searching I realized I wanted ``git-svn init __svn_url__`` to create an initialized, but empty, git repository. Following that, I ran ``git-svn fetch -r __svn_revision__`` in the git repository directory to fetch a svn checkout at the revision number. Finally, running ``git-svn rebase`` updates the checkout to HEAD (which took hours even though I only downloaded the history as far back as the start of 2.5 work). It also turns out that ``git-svn clone`` combines these steps into one.

With that done I ran ``git gc`` to "clean up" the git metadata. That also took a while.

Now I had a checkout of Python under git with history as far back as when 2.5 development started. Great, now I just needed to compile the checkout so that I could use it the next time I had to do some development.

Whoops, you can't compile. Why is that? Well, it turns out that sys.subversion requires that the $HeadURL$ autoprop from svn be replaced (see Python/sysmodule.c:932 as well as the svnversion_init() function). If it isn't set a Py_FatalError() call is made. Since this happens during the initialization of the sys module there is no way to ignore it. So unless I am willing to patch it so that sys.subversion does not require svn and it instead set to some null value if svn isn't used for the code or I explicitly add git support then you can't compile Python if you used git-svn to check it out.

So no git repository for Python for me. Oh well.