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:

  1. When building Subversion, you will need to configure && make && make install and make swig-py && make install-swig-py. You will then need to add /usr/local/lib/svn-python/ to your PYTHONPATH (typically). See subversion/bindings/swig/INSTALL in the Subversion source for full notes.
  2. 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 an svn commit. You can fake the environment that Subversion runs hooks in, but you really need to run an svn commit to be sure.
  3. Don't use the OS X download from 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 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 :)