[PATCH 2 of 2] pushkey: flush pending data before running a pre-pushkey hook (issue4607)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Apr 20 11:44:24 CDT 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1429542965 -7200
#      Mon Apr 20 17:16:05 2015 +0200
# Branch stable
# Node ID cbef1d5421d7b1e2dcb9b6e541c5749343c114a5
# Parent  2f9f8e4ca47e26dbf1183585edc364f3ef72c549
pushkey: flush pending data before running a pre-pushkey hook (issue4607)

The pre-pushkey hook will likely validate the pushkey based on element
previously changed in the same transaction. We need to make theses data
available for the hook.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1900,10 +1900,12 @@ class localrepository(object):
         try:
             tr = self.currenttransaction()
             hookargs = {}
             if tr is not None:
                 hookargs.update(tr.hookargs)
+                pending = lambda: tr.writepending() and self.root or ""
+                hookargs['pending'] = pending
             hookargs['namespace'] = namespace
             hookargs['key'] = key
             hookargs['old'] = old
             hookargs['new'] = new
             self.hook('prepushkey', throw=True, **hookargs)


More information about the Mercurial-devel mailing list