Subversion and Twitter - Keep Your Followers Up to Date With Your Code Commits

Some two months after the fact, I thought it may well be time to post a blog on this little code snippet.

As some of you have noticed every commit message to my subversion repository is infact updating my twitter.

This code was uploaded to subversion on 10/06/2009, so sorry for the late write up! Requirements

Python 2.5 or higher Subversion server

Installation

  • svn co https://svn.blog.oneiroi.co.uk/branches/python/svn_tweeter.py /usr/bin/svn_tweeter
  • chmod +x /usr/bin/svn_tweeter
  • cd /path/to/svn/hooks
  • Edit post-commit with your favorite text editor
REPOS="$1"
REV="$2"
 
/usr/bin/python /usr/bin/svn_tweeter -u twitterusername -p twitterpassword -r $REV -s $REPOS

Now try a commit, and check your syslog for entries from the script.

Aug 24 11:36:26 132 python: SVN_TWEETER: https://twitter.com/statuses/update.json query complete

UPDATE 24/03/2011 Twitter has removed basic authentication, you must use oauth (admittedly it has been like this for a fair while now) use this nagios_bot instead

Comments