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?
-
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 theirsimple.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
Will Robertson : This looks great, thanksSean Bright : You're welcome. Sorry it was the wrong answer.Will Robertson : 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!Sean Bright : Well when you do that, make sure to come back and change your accepted answer ;) -
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" commit-watchers@example.org
Just substitute the email with the address you want to send notifications to, rename the script to
hooks/post-commit
(remove thetmpl
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 optionalsubversion-tools
package.Will Robertson : Well, this certainly qualifies as "easiest". Thanks!Adam Byrtek : Good to hear I could help :)
0 comments:
Post a Comment