What is about to be pushed?

Greg Ward greg at gerg.ca
Wed Sep 2 16:10:47 CDT 2009


I'm working on an extension that really wants to hook into 'push' with
knowledge of which changesets are about to be pushed.  Failing that, I
could live with finding out which changesets were just pushed.
Unfortunately, neither of the relevant hooks are helpful: preoutgoing
is called before the change group being pushed is known, and outgoing
is only passed one of the pushed nodes, with no obvious way to find
out all of the pushed nodes.  (I suspect it's impossible in the
general case.)

One vile hack that occurs to me is for my extension to do the
equivalent of 'outgoing -q'.  That's gross because it doubles the
network traffic and server load of every push.

There must be an easier way.  It's clear that I should be
concentrating on localrepository.prepush(), but what exactly I can do
with it is unclear.  This might just be a documentation issue... ie.
if prepush() had a docstring explaining its side effects and return
value, I think I'd be fine.  Am I close?

Also, what about modifying preoutgoing hook so we also pass it a list
of all pushed nodes?  Obviously that would have to be a new kwarg, and
hooks written to use that would not work with Mercurial <= 1.3.  But
old hooks should continue to work, right?  If no one points out a
fatal flaw in that plan, I'll try to send a patch.

Greg


More information about the Mercurial-devel mailing list