Comments
Patch
@@ -180,8 +180,9 @@ def push(repo, remote, force=False, revs
if not unbundle:
lock = pushop.remote.lock()
try:
_pushdiscovery(pushop)
+ pushop.repo.events.pushafterdiscovery(pushop)
if (pushop.repo.ui.configbool('experimental', 'bundle2-exp',
False)
and pushop.remote.capable('bundle2-exp')):
_pushbundle2(pushop)
@@ -310,8 +310,14 @@ class localrepository(object):
# argument. Event handlers can modify the pushop to change what will
# be done by the push operation.
self.events.register('pushbegin')
+ # pushafterdiscovery is fired in the middle of a push operation, after
+ # discovery has been performed but before data is pushed to the remote.
+ # Event handlers receive the exchange.pushoperation instance for the
+ # in-progress push.
+ self.events.register('pushafterdiscovery')
+
def close(self):
pass
def _restrictcapabilities(self, caps):
@@ -2,10 +2,16 @@
> from mercurial import exchange
> def pushbegin(pushop):
> assert isinstance(pushop, exchange.pushoperation)
> pushop.ui.write('pushbegin %s\n' % pushop.repo.path)
+ >
+ > def pushafterdiscovery(pushop):
+ > assert isinstance(pushop, exchange.pushoperation)
+ > pushop.ui.write('pushafterdiscovery %s\n' % pushop.repo.path)
+ >
> def reposetup(ui, repo):
> repo.events.pushbegin += pushbegin
+ > repo.events.pushafterdiscovery += pushafterdiscovery
> EOF
$ hg init server
$ hg init client
@@ -23,8 +29,9 @@ Ensure push-related events are firing
$ hg push ../server
pushing to ../server
pushbegin $TESTTMP/client/.hg
searching for changes
+ pushafterdiscovery $TESTTMP/client/.hg
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files