# HG changeset patch # User Pierre-Yves David # Date 1429542950 -7200 # Node ID 0325c0da05df2589b68682e9d78c79219f32c007 # Parent 3550ccbafca2c1ef213f4f052cb44aafc4524339 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. diff -r 3550ccbafca2 -r 0325c0da05df mercurial/localrepo.py --- 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: