ANN: hgtrac extension (hg+trac integration)

James Mills prologic at shortcircuit.net.au
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:
http://hg.softcircuit.com.au/index.wsgi/tools/hgtrac/

In your .hgrc:
[extensions]
hgtrac=/path/to/hgtrac.py

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

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

[hooks]
# 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

Example:

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

Source: http://hg.softcircuit.com.au/index.wsgi/tools/hgtrac/
Wiki Page: http://www.selenic.com/mercurial/wiki/index.cgi/HgTracExtension?highlight=(CategoryExtension)

cheers
James

[1] The only rule enforced right now is "Every commit must reference a
valid open ticket".
[2] http://trac.edgewall.org/

-- 
--
-- "Problems are solved by method"


More information about the Mercurial-devel mailing list