Easiest/best way to set up SVN commit emails?

Will Robertson picture Will Robertson · Feb 1, 2009 · Viewed 27.9k times · Source

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?

Answer

Dimitar picture Dimitar · Mar 20, 2011

Although this question is a bit old, just thought I would leave my opinion for those coming here from Google:

I've considered the solutions mentioned here. The commit-email.pl was both easier and better working for me. However, I find both solutions lacking proper formatting.

Thus, the svnnotify package seems to produce well-enough formatted and colored emails for me.

On Debian/Ubuntu systems you can install it by typing:

apt-get install libsvn-notify-perl

Then, if you are gonna send emails to Gmail accounts, due to odd CSS support in Gmail, I would strongly recommend applying the patch found here, which means:

  • Download HTML.pm and ColorDiff.pm
  • Replace with them /usr/share/perl5/SVN/Notify/HTML.pm and /usr/share/perl5/SVN/Notify/HTML/ColorDiff.pm, respectively.

And finally, setup the post-commit hook script the usual way:

# email notifications for commits
/usr/bin/svnnotify --repos-path "$REPOS" --revision "$REV" \
    --to [email protected] \
    --from [email protected] \
    --with-diff \
    --subject-cx \
    --subject-prefix 'Your Project Name: ' \
    --handler HTML::ColorDiff \
    --css-inline
    2>&1 &

exit 0