Submitter | Pierre-Yves David |
---|---|
Date | April 14, 2015, 6:38 p.m. |
Message ID | <2185d86d351f85b8ce02.1429036696@marginatus.alto.octopoid.net> |
Download | mbox | patch |
Permalink | /patch/8663/ |
State | Accepted |
Commit | b9a20bfe59153e58e8c13bd7c21e83ae25da123a |
Headers | show |
Comments
On Tue, Apr 14, 2015 at 02:38:16PM -0400, Pierre-Yves David wrote: > # HG changeset patch > # User Pierre-Yves David <pierre-yves.david@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 Queued, thanks. > > 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 > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
On 04/15/2015 06:43 PM, Augie Fackler wrote: > On Tue, Apr 14, 2015 at 02:38:16PM -0400, Pierre-Yves David wrote: >> # HG changeset patch >> # User Pierre-Yves David <pierre-yves.david@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 > > Queued, thanks. I eventually grabbed that to the clowncopter to solve some merge conflict with stuff that got queued there.
Patch
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