Coding and Dismantling Stuff

Don't thank me, it's what I do.

About the author

Russell is a .Net developer based in Lancashire in the UK.  His day job is as a C# developer for the UK's largest online white-goods retailer, DRL Limited.

His weekend job entails alternately demolishing and constructing various bits of his home, much to the distress of his fiance Kelly, 3-year-old daughter Amelie, and menagerie of pets.


  1. Fix dodgy keywords Google is scraping from my blog
  2. Complete migration of NHaml from Google Code to GitHub
  3. ReTelnet Mock Telnet Server à la Jetty
  4. Learn to use Git
  5. Complete beta release FHEMDotNet
  6. Publish FHEMDotNet on Google Code
  7. Learn NancyFX library
  8. Pull RussPAll/NHaml into NHaml/NHaml
  9. Open Source Blackberry Twitter app
  10. Other stuff

Configuring Subversion on Windows to Tweet on Commit

Yesterday (and the day before, and the day before that) I spent some time try to get my Subversion install to send a message to Twitter when I commit some code.  Yes, I know it's a fairly pointless feature, but it started off as a bit of fun, which really I should have cut and run after the first hour of non-progress.  But I'm a stubborn kinda guy, so I ploughed on, and eventually got it to work.  Here's (some) of the story.

If you want to know how I got it to work, skip straight to step 4.

Step 1 - There Must be a Twitter Plugin...

I'd just done exactly the same thing with my Jenkins server, and that seriously took all of 10 minutes.  I browsed the plugin repositroy, found one that tweets after a Jenkins build, I installed it, configured the necessary OAuth stuff, and I'm off.  Job done.

So I approached Subversion (naively) in the same way - there must be a plugin, right?  I can't be the only person who's thought of this?

Wait!  Subversion doesn't do plugins, does it?  Damn.  Okay, a little googling later, and up comes TwitVN, which looks promising - let's start following the instructions. 

Step 2 - Install Python

First off, I head across to to download an up-to-date copy of Python.  I install the thing (c:\python27?  That install location doesn't sit too well with me!), open up a command prompt, and test it out.  I can run the exe no problem, Ctrl+Z followed by Enter to exit (huh!?), and I'm back at a command prompt.

I now need "easy_install" apparently, this comes easily enough from, again this works okay, so far so good!  I pull down the tools that TwitVN needs (simplejson and Tweepy), and I'm now ready to test TwitVN.

Step 3 - Waste a Few Hours with Python SVN Addons

To test TwitVN, I discover I need to replace my file with a post-commit.bat file, since Windows SVN doesn't have the ability to run these python scripts apparently.  So I create a post-commit batch file with the following command:

c:\python27\python.exe d:\path\to\post-commit.bat

And then I execute said batch file.  Damn, the first thing I get is an error about a missing module "svn.repos".  Okay, there's just another "egg" I need to install with that easy_install tool, right?  Nope.  Well then there's going to be a website with all the stuff where I can run some simple process to do the install, and there's gotta be a ton of people messing around with Python and Subversion on Windows anyhow?  Again nope (in this case nope twice).

There are some promising results showing up in Google, but it turns out that since Subversion is currently migrating to the Apache guys, there're broken links all over the place.  Not only that, there seem to be multiple libraries available - there's something called PySvn, which seems like my best bet, but that doesn't seem to match the libraries that my TwitVn script uses, so that's a no go.  Most of the hours wasted on this little project went into searching (in vain) for the right Python module.

Step 4 - Uninstall Python, and Install A Subversion Server with Python Integrated

At this point, a different plan of attack.  Rather than trying to put all these bits together myself, I had a vague recollection that there was a distribution of Subversion that already had Python integrated, and if so it MUST have the svn.* modules preloaded?  Let's investigate...

I end up doing the following:

  1. Uninstall existing non-Collabnet Subversion installation
  2. Install Collabnet's Subversion Edge, which has integrated Python (for some reason this took me an hour for an 80 meg file)
  3. Check that you now have the following two files present:
    • c:\csvn\python25\python.exe
    • c:\csvn\lib\svn-python
  4. First hack - at this point I had to do a registry hack to get the next tool to install correctly:
    • Open regedit
    • Navigate to "HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.5\InstallPath"
    • There should be a (Default) entry under this key, if there are quotation marks around the path name for this value, you'll need to remove them.
  5. Follow the TwitVn instrctions at
    1. Install the "easy_install" tool from  When installing this tool, check the two folder locations it gives you are valid.
    2. Open a command prompt, navigate to C:\csvn\Python25\Scripts
    3. Type in "easy_install simplejson" to install Simplejson
    4. Type in "easy_install tweepy" to install Tweepy
    5. Navigate to the "hooks" folder in your Subversion repository folderAdd a "post-commit.bat" file with the following lines:
      • set PYTHONPATH=C:\csvn\lib\svn-python
      • c:\csvn\python25\python.exe D:\path\to\svn\repository\hooks\TwitVN\ -f "%1" -r "%2"
    6. Complete the OAuth config as per the TwitVn instructions.
  6. Test your batch file by opening a command prompt in this location, and entering "post-commit d:\path\to\svn\repository 1"
  7. Second hack - at this point I got a pop-up window saying "libapr-1.dll was not found":
    1. Copy all of the DLLs from "c:\csvn\bin" to "c:\windows\system32" 
  8. Test your script again, at this point I now got an error about using the "len" function on the author field.  This is because none of my subversion commits have an author.
  9. To fix this, consider adding the following to your just before the line that generates the error:
    • if not author: author = "Anon"
  10. One more test, and lo and behold, it works!

Granted, this isn't the most productive use of my time I can recall, but it's been an adventure at least!

Permalink | Comments (0)

Add comment

  Country flag

  • Comment
  • Preview