tags:

views:

653

answers:

2

I'd like to set up commit emails on a project I'm work on, as described here:
http://producingoss.com/en/vc.html#commit-emails

That is, use a post commit hook to send an email to a list containing the commit title/log and diff of the changes.

What's the easiest way on a Linux machine to set this up?

+5  A: 

We use svnmailer for this. We symlink our repository-specific post-commit hook scripts to a single script, which in turn calls svnmailer. The configuration is pretty straight forward, and with their simple.conf example configuration you can be up and running in a few minutes. Note that it is written in Python, so that is a prerequisite to installation.

Our entire post-commit hook script is only a few lines (note that you might do other stuff in your post-commit hook, but we currently don't):

#!/bin/sh

CONFIG="/usr/local/svnmailer/default.conf"
MAILER="/usr/bin/svn-mailer"

# These are passed in by subversion
REPOS="$1"
REV="$2"

"${MAILER}" --commit \
            --config "${CONFIG}" \
            --repository "${REPOS}" \
            --revision "${REV}" \
            --background
Sean Bright
This looks great, thanks
Will Robertson
You're welcome. Sorry it was the wrong answer.
Sean Bright
If I could have accepted both, I would have. As soon as I find commit-email.pl too limiting, I'm running straight to svnmailer. Thanks again!
Will Robertson
Well when you do that, make sure to come back and change your accepted answer ;)
Sean Bright
+2  A: 

When creating new repository a sample post-commit hook is provided in hooks/post-commit.tmpl. It contains a line that looks more or less like this:

/usr/share/subversion/hook-scripts/commit-email.pl "$REPOS" "$REV" [email protected]

Just substitute the email with the address you want to send notifications to, rename the script to hooks/post-commit (remove the tmpl extension) and make it executable (chmod a+x).

When you run the commit-email.pl script without any arguments you will see an usage screen with extra options that allow for example to modify the subject line or the From address.

Please note that is case of Debian the commit-email.pl script is located in an optional subversion-tools package.

Adam Byrtek
Well, this certainly qualifies as "easiest". Thanks!
Will Robertson
Good to hear I could help :)
Adam Byrtek