Richard Jones' Log: Subversion extension lessons
Tue, 05 Apr 2005
So I'm finding myself working with Subversion's Python API. Shh, it's a secret. Kinda. Anyway, I've a couple of little gems to impart:
- When building Subversion, you will need to
configure && make && make install
andmake swig-py && make install-swig-py
. You will then need to add/usr/local/lib/svn-python/
to your PYTHONPATH (typically). Seesubversion/bindings/swig/INSTALL
in the Subversion source for full notes. - From the beginning,
import logging
and use a top-level exception handler, as you're not going to get any debug information out of Subversion when you test using ansvn commit
. You can fake the environment that Subversion runs hooks in, but you really need to run ansvn commit
to be sure. - Don't use the OS X download from http://www.codingmonkeys.de/mbo if you want the Python bindings. And I've forgotten how to uninstall packages, so I've not tried the death-of-a-thousand-cuts install provided by http://www.wsanchez.net/blog/ yet (of course I'm grateful to both people for even packaging the software - I tried for about an hour to compile it manually with no luck). Update: the wsanchez packages don't include the python bindings either. Now attempting to compile from soruce.
So I wrote a bunch of "hook" code on the train this morning, but I can't actually test it until I get home to my Linux desktop. If anyone knows of any actual documentation for writing hooks, I'd be very grateful, as at the moment I'm guessing a lot. I also have to chuckle at the memory pools being passed around. Man, I so don't miss coding in C :)