ANN: hgtrac extension (hg+trac integration)

James Mills prologic at
Wed Nov 5 18:13:02 CST 2008

Hi all,

For the impatient, this extension is basically
an integration of the trac-pre-commit and
trac-post-commit hook scripts from the Trac (2)
project and are combined together in a nice
extension that works with Mercurial and uses
XML-RPC to communicate with the remote
Trac instance.

As some of you may know, I have been working
on a Mercurial Extension that better integrates
with Trac. It's called "hgtrac".

hgtrac can be hooked into either of the commit
or changegroup events, and can also be
hooked into the pretxncommit event to enforce
certain rules (1).

To instlal hgtrac, download from:

In your .hgrc:

hgtrac uses settings stores in the current
mercurial repository. To configure hgtrac
edit the .hg/hgrc file of your repository to
include the following:

url = http://user:pass@host/trac/login/xmlrpc

# Enforce rules before commit
#pretxncommit.hgtrac = python:hgtrac.hook
# Update Trac tickets after commit
#commit.hgtrac = python:hgtrac.hook
# Update Trac tickets on incoming changesets of a remote repo.
changegroup.hgtrac = python:hgtrac.hook

To use hgtrac in your work, all you have to
do is change the way you write your commit
messages. Please read the documentation
of hgtrac itself: pydoc hgtrac


$ cd foo
... hack hack hack ...
$ hg ci -m "Fixes #1 (1) some useful messages"

Wiki Page:


[1] The only rule enforced right now is "Every commit must reference a
valid open ticket".

-- "Problems are solved by method"

More information about the Mercurial-devel mailing list