SVN email notifications - svn-mod-email


I have recently published a module to subversion software for sending email notifications about commits. It is distributed as a debian package and can be downloaded from Google Code under terms of the GPL. My fascination when writing this post is even bigger as this is my first Debian package downloadable publicly. I encourage anyone for testing it and sharing any constructive feedback.

About the package

The package consists of two Perl scripts:
  • svnennotification - used to enable / disable email notifications for SVN repositories
  • svnnotification - sends email notifications after SVN commit to repository
For each of the scripts you may refer into their corresponding man pages to display all the available options. 

The svnnotification script is destined to be run from the post-commit hook and it shouldn't be executed manually. It provides an engine for gathering all the information about the commit and building a list of recipients that should be notified by email message. It also actualy sends an email notification to the recipients. The scripts uses email and email.conf files inside the conf directory of the repository that are created by svnennotification script.

While the svnnotification script is what actually does the job, the main purpose of the svnennotification script is to manage the post-commit hook of the repository and the configuration files inside its conf directory:
  • email - determines SVN repositories, its sub-repositories and corresponding email  addresses  of users, that should receive email notifications
  • email.conf - contains  global settings regarding email system
In general its purpose is to either enable or disable email notification for the SVN repository.

As for the scripts you may also refer into man pages of the configuration files for all the detailed information about their structure.


The following section shows common example of package usage starting with its installation, going threw its configuration and finally ending up with working notifications.

1) Installation:

To install the package first download it from the following website:

# wget

Then install the package as a regular Debian archive:

# dpkg -i svn-mod-email_1.0_all.deb

If you'll notice any error messages regarding missing dependencies, install them by running the following command:

# apt-get -f install

2) Configuration:

You're ready to start using the module. Now you need to run the svnennotification command to enable the notifications for the SVN repository. Simply run the command with a path to the repository as an argument:

# svnennotification /srv/svn/repo

You may pass much more options into the command. Please, refer to the man pages for details. 

The above will create or update /srv/svn/repo/hooks/post-commit hook and create the /srv/svn/repo/conf/email and /srv/svn/repo/conf/email.conf files. Now you need to configure them. Lets start with the email.conf file that contains global settings regarding your email system. You may either refer to the man page for the file or simply read it that there is clearly explained what does any option stand for.

After updating the email.conf file it's time to take care of the email file that actually determines SVN repository, its sub-repositories and corresponding email  addresses of users that should receive email notifications. The structure of the file is similar to the authz file, but instead of access rights it determines email addresses of the recipients. The following is a simple example of the file:



In such a case if a commit is made to the main repository only user1 will receive a notification. Whether the commit is made to the subrepo directory inside the main repo anyway both user1 and user2 will receive email notification. Please, refer to the man page for the file to read more about its contect and configuration possibilities.

3) Usage:

After performing all the above steps there are no more requirements to start using the module. Simply run your first commit into the repository and enjoy email notifications about the changes that you've just made!

No comments:

Post a Comment