[PATCH stable] keyword: do not postpone commit hooks

Christian Ebert blacktrash at gmx.net
Wed Feb 17 10:13:53 CST 2010


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1266423080 -3600
# Branch stable
# Node ID 8e2bd56b856031fc583c91bdc8f0b2eb88c81b2d
# Parent  0e64d814d7d0a4d3cce3bf91f5e3a1f3703fa642
keyword: do not postpone commit hooks

With 0e64d814d7d0 in place, this hack is not needed any more.

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -480,14 +480,7 @@
             # other extensions can still wrap repo.commitctx directly
             self.commitctx = self.kwcommitctx
             try:
-                self._kwcommithooks = {}
-                n = super(kwrepo, self).commit(*args, **opts)
-                if self._kwcommithooks:
-                    xp1, xp2 = self._kwxp1, self._kwxp2
-                    for name, cmd in self._kwcommithooks.iteritems():
-                        ui.setconfig('hooks', name, cmd)
-                    self.hook('commit', node=n, parent1=xp1, parent2=xp2)
-                return n
+                return super(kwrepo, self).commit(*args, **opts)
             finally:
                 del self.commitctx
 
@@ -496,18 +489,7 @@
             try:
                 wlock = self.wlock()
                 lock = self.lock()
-                # store and postpone commit hooks
-                for name, cmd in ui.configitems('hooks'):
-                    if name.split('.', 1)[0] == 'commit':
-                        self._kwcommithooks[name] = cmd
-                        ui.setconfig('hooks', name, None)
-                if self._kwcommithooks:
-                    # store parents for commit hooks
-                    p1, p2 = ctx.p1(), ctx.p2()
-                    self._kwxp1, self._kwxp2 = p1.hex(), p2 and p2.hex() or ''
-
                 n = super(kwrepo, self).commitctx(ctx, error)
-
                 kwt.overwrite(n, True, None)
                 return n
             finally:


More information about the Mercurial-devel mailing list