Setting up Commit Emails
Before we begin, ensure that mail can be sent from the server on which the subversion repository lives. If you're on a UNIX OS, this can be done by running the mail program from the command line,
prompt:> mail -s "test subject" email@example.com Type in body of email and press CTRL-D to send. ^D prompt:>
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. If you cannot find it, get it from here.
- Create a copy of post-commit.tmpl named post-commit
- Edit post-commit and add the following before the call to commit-email.pl
- 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.
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.
You might also want to make sure this user can send emails to the mailserver. Log in as the user and use the mail command to test this.