SVN Commit Notifications over Growl

CromeDome on 2009-05-06T16:25:35

We're primarily a Windows shop. That doesn't have to relegate us to second-class citizens in the software development world, however. We have long used Perl for our web-based products, and development of our Windows client apps has gradually come to incorporate some of the practices and tools that we've grown accustomed to when developing in Perl.

In the not-so-distant future, we're taking a huge step off of Visual SourceSafe and moving to Subversion. We've long been using Subversion for our web apps, and upcoming developments in Powerbuilder will finally allow us to migrate away from VSS once and for all. We have a comfort level with Subversion, but before we totally take the plunge, we wanted to find ways to get more out of our version control software. Enter Growl.

Those of you who have used Growl on OS/X, you might not be aware that a Windows port is also available. It's kinda rough around the edges, but for the most part is pretty stable and handy. We wanted to use Growl to notify developers of recent commits to the source tree. Some of you might already do this, or something more robust, but it's something we recently implemented, and it's been tremendously useful. I find that developers are more informed as to what other people are up to, and gives people a gentle reminder to update their sandbox every now and again ;-)

To get started, make sure you have a Subversion server in place. If you are hosting repositories on a Windows server, I highly recommend VisualSVN Server. It has a nice MMC snap-in, and is easy for anyone with Windows experience to administrate. Install Growl for Windows on the same box - you're going to need it to communicate with your developers. When configuring Growl, make sure to enable "Allow Network Notifications" and "Allow Clients to Subscribe to Notifications". You will also have to add a password - network Growl (at least on Windows) will not work without one.

Create a sandbox on your Subversion server. The post-commit hooks will need one to operate on. You can use our post-commit hook scripts as a starting point.

post-commit.bat is what is actually run by Subversion. It executes post-commit-run.bat and logs the output (I can't take credit for this - I got the idea from Dan G. Switzer's blog). If something bad happens, this log is the only way you're going to see what it is.

post-commit-run.bat does a couple of things for us. It updates the copy of the sandbox on the Subversion server, then captures the log entry of the last commit. It then executes some Perl that broadcasts that log message over Growl. The first time you use this batch file, make sure you specify the user name and password of a Subversion user on the svn calls to give Subversion an opportunity to cache credentials. I haven't found another way of accomplishing this (and I am open to suggestions here!). Once the hook is run, you can remove them from the batch file.

To make Subversion cache credentials on Windows, add the following registry entries through regedit: [HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config\auth] "store-passwords"="yes" (taken from the online Subversion book)

As for the Perl program, it simply uses GNTP::Growl to broadcast the latest log message over Growl. I do not think that Growl on Mac currently supports GNTP, but think there is plans for such in the hopper.

Each developer that is receiving notifications will need Growl installed. On the Network tab, they should create a subscription to the Subversion server machine.

This isn't elegant, but it has worked pretty well for us.

Good luck! Hope you find this useful!


GNTP::Growl was renamed to Growl::GNTP

mattn on 2009-09-18T07:36:20

Sorry, I was changed name of GNTP::Growl to Growl::GNTP. X-(