← Back to team overview

fenics team mailing list archive

hg-notify

 

Here's a simple script for sending notification emails on hg commits.
It's an improvement over what we've had so far for the repositories on
fenics.org:

1. Much simpler, only a single line (or two) in .hg/hgrc in the
repository is needed (separate script not needed anymore).

2. Notifies on each changeset (not changegroup). If needed, this can
be fine-tuned in the hgrc file.

The script is in the PATH on fenics.org, so to add notification for a
repository, just add the following lines to .hg/hgrc:

  [hooks]
  incoming = hg-notify repository email(s)

This simplifies setting up new repositories (for collaboration on
papers, presentations, development repositories etc) with notification
to particular authors etc.

/Anders


(hg-notify included below for reference)

#!/usr/bin/env python

import sys, commands

if not len(sys.argv) >= 3:
    print "hg-notify: Repository and/or email address not specified"

repository = sys.argv[1]
emails = " ".join(sys.argv[2:])

summary = commands.getoutput("hg log -r tip | grep '^summary:' | cut -b 14-")
subject = "[HG %s] %s" % (repository, summary)

commands.getoutput("hg log -r tip | mail -s '%s' %s" % (subject, emails))


Follow ups