SVN notifications

July 9th, 2008 by Mariano Leave a reply »

I’ve been investigating how to send notification emails when changes are committed in a Subversion repository. Two interesting options I found are svnnotify and svnmailer.

svnnotify looks reasonable (read the man page). It generates HTML email with colored diffs (not as nice as Trac’s diff engine) and is configurable via CLI options to send email to different addresses based on regular expression matches against the directories affected by the commit.

Example: put this in “/repo/hooks/post-commit”

#!/bin/sh
 
REPOS="$1"
REV="$2"
 
/opt/perl/bin/svnnotify \
    -p $REPOS \
    -r $REV \
    -C -d -H HTML::ColorDiff \
    --from admin@example.com \
    --reply-to somebody@example.com \
    -x foo@example.com="^foo/" \
    -x "team1@example.com,team2@example.com"="^big_framework/" \
    -x other@example.com="^one|^two|^three"

I also looked at svnmailer but it uses unified diff format by default which doesn’t look so nice. You can specify your own diff script via the CLI, but I don’t know of any good ones off hand.

Can anyone suggest a good diff script?
Anybody know offhand if Trac uses a standalone diff engine that I could hook up to svnmailer?

Advertisement

Leave a Reply