pushkey: use hook arguments from transaction when one exists
When pushkey is called during a transaction, we include its 'hookargs' when
running the pre-pushkey hooks. Having more data cannot hurt, especially the
transaction ID.
--- a/mercurial/localrepo.py Mon Apr 20 14:47:51 2015 -0400
+++ b/mercurial/localrepo.py Mon Apr 20 17:15:50 2015 +0200
@@ -1901,8 +1901,15 @@
def pushkey(self, namespace, key, old, new):
try:
- self.hook('prepushkey', throw=True, namespace=namespace, key=key,
- old=old, new=new)
+ tr = self.currenttransaction()
+ hookargs = {}
+ if tr is not None:
+ hookargs.update(tr.hookargs)
+ hookargs['namespace'] = namespace
+ hookargs['key'] = key
+ hookargs['old'] = old
+ hookargs['new'] = new
+ self.hook('prepushkey', throw=True, **hookargs)
except error.HookAbort, exc:
self.ui.write_err(_("pushkey-abort: %s\n") % exc)
if exc.hint: