We build Web & Mobile Applications.

< All Articles

Twitter your SVN Commit Messages

It’s been done before, but a while back I played around with making a simple Twitter post-commit hook for Subversion. Whilst doing a spot of spring cleaning I stumbled across it sitting alone on my hard drive so figured I may as well push it to GitHub for the public to enjoy!

There may be other Ruby scripts that achieve the same - it was a while ago when I looked and at the time nothing significant came up in my Googling.

The script makes use of John Nunemaker’s twitter gem - it reduces our Twitter involvement to a single line!

To setup is simple - put the script somewhere accessible and make it executable. Next, edit the post-commit file in the hooks directory of your SVN repository to contain:

REPOS="$1"
REV="$2"
<path to script>/ruby_scm_twitter.rb -u <twitter username> -p <twitter password> -f "${REPOS}" -r "${REV}"

Obviously replacing the path to the script and username and password with the correct values.

You also need to make sure svnlook is available from your PATH - otherwise you might need to edit the script and put in the absolute path to the tool. I did look at using the Ruby SVN bindings - but decided not to spend an hour figuring out how to do something that I could already do in 10 seconds.

My initial plan was to add in some more complex configuration ability - i.e. to specify specific twitter accounts for specific repositories or paths - but given all the cool kids have moved to GitHub then I’m not sure how much demand there would be for this.

Happy Twitter committing!

Updated on 07 February 2019
First published by Chris Anderton on 05 March 2009
© Chris Anderton 2019
"Twitter your SVN Commit Messages" by Chris Anderton at TheWebFellas is licensed under a Creative Commons Attribution 4.0 International License.