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
block $ 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
Copy post-commit.tmpl to post-commit.
In the top level directory of your Subversion repository, you should see a directory called
hooks. Change into that directory and copy
post-commit, and make sure this script is executable. This is where the magic happens.
post-commitscript includes some commands by default. For example, mine contained the following lines
block commit-email.pl "$REPOS" "$REV" firstname.lastname@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 following
block REPOS="$1" REV="$2" /usr/bin/svnnotify --repos-path "$1" --revision "$2" --to email@example.com --handler HTML::ColorDiff --svnlook /usr/bin/svnlook --with-diff
Remember to replace 'firstname.lastname@example.org' 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.