transaction: actually use tr.hookargs in pretxnclose
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 14 Apr 2015 13:07:41 -0400
changeset 24739 ea0d5c8e047f
parent 24738 457e26da029b
child 24740 d283517b260b
transaction: actually use tr.hookargs in pretxnclose The 'tr.hookargs' is a dictionary containing all the arguments to be passed to hooks. It is actually used for hooks now...
mercurial/localrepo.py
tests/test-hook.t
--- a/mercurial/localrepo.py	Sat Apr 11 13:58:36 2015 -0400
+++ b/mercurial/localrepo.py	Tue Apr 14 13:07:41 2015 -0400
@@ -956,7 +956,7 @@
             """will run pre-closing hooks"""
             pending = lambda: tr.writepending() and self.root or ""
             reporef().hook('pretxnclose', throw=True, pending=pending,
-                           xnname=desc)
+                           xnname=desc, **tr.hookargs)
 
         tr = transaction.transaction(rp, self.sopener, vfsmap,
                                      "journal",
--- a/tests/test-hook.t	Sat Apr 11 13:58:36 2015 -0400
+++ b/tests/test-hook.t	Tue Apr 14 13:07:41 2015 -0400
@@ -23,7 +23,7 @@
   pretxnopen hook: HG_TXNNAME=commit
   pretxncommit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a
   0:cb9a9f314b8b
-  pretxnclose hook: HG_PENDING=$TESTTMP/a HG_XNNAME=commit
+  pretxnclose hook: HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_XNNAME=commit
   txnclose hook: HG_PHASES_MOVED=1 HG_TXNNAME=commit
   commit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
   commit.b hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
@@ -218,7 +218,7 @@
   searching for changes
   no changes found
   pretxnopen hook: HG_TXNNAME=bookmarks
-  pretxnclose hook: HG_PENDING=$TESTTMP/a HG_XNNAME=bookmarks
+  pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_PENDING=$TESTTMP/a HG_XNNAME=bookmarks
   txnclose hook: HG_BOOKMARK_MOVED=1 HG_TXNNAME=bookmarks
   pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
   exporting bookmark foo