Is there any way to run a script after a changeset pushed to a repository?

Martin Geisler mg at
Tue Mar 4 14:43:55 CST 2008

"Neo Jia" <neojia at> writes:


> I am wondering if there is any way to run a script against a "push",
> so I can automatically generate something for each submission, such as
> doing "qrefresh" and "qnew" for each submission.

Yes, use the changegroup hook in a .hg/hgrc file:

That would be something like this if you want to run qrefresh:

  changegroup = hg qrefresh > /dev/null

I am redirecting stdout to /dev/null since (in my experience) hook
commands must not generate output when you push over SSH. I believe the
reason is that stdout is mixed with the Mercurial protocol and so things
break in strange ways, e.g., you will get a backtrack that says 'invalid
literal for int(): foo bar' or something like that.

Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multi-Party Computation) to Python. See:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : 

More information about the Mercurial mailing list