changeset 24824:0325c0da05df stable

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 20 Apr 2015 17:15:50 +0200
parents 3550ccbafca2
children 7f9655f37163
files mercurial/localrepo.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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: