How to add a post-commit mailing on SVN Comments Off
Here is a short mémo on how setting up an automatic emailing when a user commits files on a svn repository
Assuming you use a Ubuntu/Debian-based OS.
- First step : make sure you have a functionnal SVN-repository on the machine
- 2nd step : we’ll need libsvn-notify-perl package :
sudo apt-get install libsvn-notify-perl - You may now have the svnnotify binary in /usr/bin/ or something like this. try
whereis svnnotifyif you don’t know where it is - go to you repository’s directory:
cd /home/myname/svn/project1/ - create a file named post-commit in ./hooks/ and make it executable by www-data
touch ./hooks/post-commit && chown www-data:www-data ./hooks/post-commit && sudo chmod u+x ./hooks/post-commit - Now edit post-commit file and write the following :
#!/bin/sh
REPOS="$1"
REV="$2"
/usr/bin/svnnotify -r "$REV" -C -d -H Alternative \
--alt HTML::ColorDiff -p "$REPOS" -t "to@domain.tld" \
--from 'from @ domain.tld' \
just replace to@domain.tld and from@domain.tld by your correct email adresses (advising that to@domain.tld may be a mailing-list that mail all the people that work on the project) - Additionnaly, you can add this :
--reply-to `cat "/home/myname/etc/svn-authors/myproject/$AUTHOR"`\assuming that you have files that contains the email of each svn-user in the /home/myname/etc/svn-authors/myproject/ directory
E.G : in the etc/svn-authors/myproject/ directory you can
echo -n 'firstName.lastName@domain.tld' > userPseudoforeach of yours svn-users
Good luck !
Tags: devloppement, svn, sysadmin, tips, tool, ubuntu




