SVN Tips
Setting up Commit Emails
Before we begin, ensure that mail can be sent from the server on which the subversion repository lives. This can be as simple as running the mail program from the command line,
prompt:> mail -s "test subject" someone@somewhere.com Type in body of email and press CTRL-D to send. ^D
Next, go to the hooks/ directory of our subversion repository. It should contain several files ending in .tmpl. These are shell script templates that allow you to hook actions to subversion events. In particular, we are looking for post-commit.tmpl which we will use to send email whenever a commit is made.
- Ensure that commit-email.pl exists in hooks/ directory
- Create a copy of post-commit.tmpl named post-commit
- Edit post-commit and add the following before the call to commit-email.pl
PATH=/path/to/subversion/hooks
- Comment out log-commit.py if present, it's not necessary. This script only needs to do commit-email.pl
- Specify the email or space separated list of emails to send these commit notifications to as the last arguments to commit-email.pl
- Make sure that commit-email.pl and post-commit are executable by anyone
chmod a+x commit-email.pl post-commit
This should basically be it. Commit something to test things out. If there is a problem, it will usually show up in the mail server logs. The next sections cover possible issues.
Permission Denied
If you're running svnserve to allow checkout using svn:// URL notation, then you have to make sure that the user that runs svnserve can also read and execute the scripts in hooks/. Make sure this user owns that directory and all files in it.