[PATCH] transaction: actually use tr.hookargs in pretxnclose
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Apr 14 18:38:16 UTC 2015
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1429031261 14400
# Tue Apr 14 13:07:41 2015 -0400
# Node ID 2185d86d351f85b8ce024ef18b594ea73792ad5f
# Parent c229ba58b956c7872af7ed220ad5099ea4a6ecf7
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...
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -954,11 +954,11 @@ class localrepository(object):
reporef = weakref.ref(self)
def validate(tr):
"""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",
"undo",
aftertrans(renames),
diff --git a/tests/test-hook.t b/tests/test-hook.t
--- a/tests/test-hook.t
+++ b/tests/test-hook.t
@@ -21,11 +21,11 @@ commit hooks can see env vars
$ hg commit -m a
precommit hook: HG_PARENT1=0000000000000000000000000000000000000000
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
$ hg clone . ../b
@@ -216,11 +216,11 @@ pushkey hook
$ hg push -B foo ../a
pushing to ../a
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
[1]
$ cd ../a
More information about the Mercurial-devel
mailing list