If you have administrative access to a repository, you can arrange for an email to be sent out each time a commit is made. This is a commit notification.

Uses

  • Users of a repository can be informed of changes almost as soon as they occur. A user can then go to a working copy of his, update it, and try out the latest changes.

  • Other tools can be triggered as often as they need to. For example, you may wish to upload a revision-controlled website as soon as it changes.

Setting up a notification

Go to any folder in your repository, one under the address https://scc-forge.lancaster.ac.uk/svn-repos/, and follow the Hook scripts link. You'll see a table listing new and existing scripts for that repository. Pick one of the following from the Add entries:

  • Send email on commit — if you just want a brief email with a list of changed files, suitable for most cases.
  • Send detailed email on commit — for extremely verbose messages showing line-by-line changes.
  • Send signal email on commit — for triggering automated scripts that only need headers.

Submit your selection to make an entry appear in the upper part of the table. Fill in its fields for the subject line and destination email address, activate the script, and submit again.

You should specify only one address, but you can instantiate the script as many times as necessary.

Message format

Notification emails are in HTML, and list basic characteristics of the commit.

Messages are sent out with the header X-SVN-Hook: post-commit (for unequivocal identification by filters), and appear to come from <forge at comp.lancs.ac.uk>. Also note that X-SVN-Repository and X-SVN-Revision identify the repository and its new revision number, and X-SVN-Common-Prefix identifies the common path of all changes within the repository.

Notifying multiple users

If you have only a few users, it is simplest to instantiate the script once per user. However, if the number of users who may be interested in commit notifications is large or unlimited, create a mailing list, and issue the notifications to that list.

Invoking external tools

You can issue emails to cause automatic processing at another site. This depends on how you configure the remote system to respond to email.

For example, you might set up a procmail filter to run a script:

:0
* ^From:.*forge@comp.lancs.ac.uk
* ^X-SVN-Hook:.*post-commit
| $HOME/sbin/update-website

You might wish to be more selective by filtering on X-SVN-Path, which appears once for each modified folder.


Lancaster University
© School of Computing and Communications, Lancaster University – Disclaimer & copyright
Some images from PixelMixer