HTML Commit Email Notification for Mercurial

This code uses a modified version of the hook script from version
0.9.4 of the Mercurial ( distribution to
gather commit information. It also uses a modified version of the cvsspam email
code from the CVSspam (

Both Mercurial and CVSspam are released under the terms of the GPL v2, and so
is this code (see COPYING).

Setting up email notification

Assuming you've already made your repository accessible on a server
(if you haven't, look at
for information on publishing repositories), you'll want to edit the
.hg/hgrc file in the server's repository. If there's no .hg/hgrc,
create one, and add these lines:

gsnotify = /var/lib/hgspam/

incoming.notify = python:gsnotify.hook

emailer = /var/lib/hgspam/cvsspam.rb
emailconfig = /var/lib/hgspam/cvsspam.conf

The [extensions] section tells Mercurial to load the gsnotify plugin:
gsnotify = /var/lib/hgspam/

The [hooks] section tells Mercurial to call the hook() method in the script whenever it sees an incoming (pushed) changeset.

The [notify] section contains settings for the plugin,
telling it where to find cvsspam.rb and the cvsspam config file.

You'll want to replace /var/lib/hgspam with the path to where you've
put the email scripts.

You'll also want to create a cvsspam config file. The sample config
cvsspam.conf file provided is well-commented and should be easy to
figure out. Generally you just need to add one email recipient. If you
don't have a local mail server (Sendmail compatible), you'll want to
specify an SMTP server for email.