subversion post-commit hook to send email on every commit
one of the most powerful tools an agile development team can have is the ability to quickly perform code reviews as commits happen. but no one wants to type svn log -v and svn diff -r whatever all the time. that’s too much work.
a better alternative is to simply email diffs your developers each time a commit occurs. here’s how you make it happen with svn and svnmailer (fedora: sudo yum install svnmailer).
first, set up your svn post commit hook:
$ cat /var/lib/svn/hooks/post-commit REPOS="$1" REV="$2" /usr/bin/svn-mailer -d "$REPOS" -r "$REV" -f /etc/svn-mailer.conf
second, configure svnmailer:
$ cat /etc/svn-mailer.conf [general] sendmail_command = /usr/sbin/sendmail long_mail_action = 10000 truncate # truncate emails over 10,000 lines [defaults] diff = /usr/bin/diff -u -L %(label_from)s -L %(label_to)s %(from)s %(to)s commit_subject_prefix = [svn] from_addr = committers@example.com to_addr = committers@example.com generate_diffs = add copy modify mail_transfer_encoding = 8bit # your svn projects [myproject1] for_paths = myproject1/.* commit_subject_prefix = [svn] [myproject1] [myproject2] for_paths = myproject2/.* commit_subject_prefix = [svn] [myproject2]
that’s it. all done. make a commit and wait for an email with diffs. learn more about svnmailer (including more configuration options) at svnmailer’s website.
About this entry
You’re currently reading “subversion post-commit hook to send email on every commit,” an entry on e-huned.com
- Published:
- 08.19.08 / 9am
- Category:
- personal
1 Comment
Jump to comment form | comments rss [?] | trackback uri [?]