Sometimes it seems like a great idea to receive updates whenever someone commits something to your Subversion repository, right? This has definitely seemed like a good idea to me, but it's only nice if you work in a small shop with only a few developers. Too many developers make this solution more of a headache than anything else. But, if you really like to keep up with what's going on and you are undaunted by the influx of email, the setup isn't difficult at all.
-
Install the SVN::Notify Perl module.
The first thing you should do is install SVN::Notify. Many ports collections include this module (MacPorts for example), so your installation may be as simple as running the appropriate install command (sudo port install p5-svn-notify
, perhaps?). If your ports collection doesn't include this module, installation should be as simple as$ perl Makefile.PL $ make $ sudo make install
Once you have installed the module, you'll need to know the location of
svnnotify
. For the sake of this article, we'll assume that it is/usr/bin/svnnotify
. -
Copy post-commit.tmpl to post-commit.
In the top level directory of your Subversion repository, you should see a directory calledhooks
. Change into that directory and copypost-commit.tmpl
topost-commit
, and make sure this script is executable. This is where the magic happens. -
Update post-commit.
Thepost-commit
script includes some commands by default. For example, mine contained the following linescommit-email.pl "$REPOS" "$REV" commit-watchers@example.org log-commit.py --repository "$REPOS" --revision "$REV"
Those lines are not what we want to do, so comment them out (using
#
) and add the followingREPOS="$1" REV="$2" /usr/bin/svnnotify --repos-path "$1" --revision "$2" --to svn@slaptijack.com --handler HTML::ColorDiff --svnlook /usr/bin/svnlook --with-diff
Remember to replace 'svn@slaptijack.com' with your own email address.
It really is that easy. After this, you should start getting nice color diffs emailed to the email address indicated.
Update: Corey Gilmore apparently had the same brainwave about a week before I did: Subversion: Emailing users on commit.