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

Martin Geisler mg at daimi.au.dk
Tue Mar 4 14:43:55 CST 2008


"Neo Jia" <neojia at gmail.com> writes:

Hello

> 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:

  http://www.selenic.com/mercurial/wiki/index.cgi/Hook

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

  [hooks]
  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: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial/attachments/20080304/9a0f06cb/attachment.pgp 


More information about the Mercurial mailing list