pushkey: use hook arguments from transaction when one exists stable
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 20 Apr 2015 17:15:50 +0200
branchstable
changeset 24824 0325c0da05df
parent 24823 3550ccbafca2
child 24825 7f9655f37163
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.
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: