[PATCH 3 of 5] keyword: wrap usercommitctx() instead of commitctx()

Dan Villiom Podlaski Christiansen danchr at gmail.com
Tue Jul 13 07:16:21 CDT 2010


# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1279022125 -7200
# Node ID 791a73b5d82a4c2315c6edeef8b1015b4309bab6
# Parent  157d8a90f044060a0d61210926cdf335ed3dd96f
keyword: wrap usercommitctx() instead of commitctx().

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -485,17 +485,8 @@ def reposetup(ui, repo):
             data = super(kwrepo, self).wread(filename)
             return kwt.wread(filename, data)
 
-        def commit(self, *args, **opts):
-            # use custom commitctx for user commands
-            # other extensions can still wrap repo.commitctx directly
-            self.commitctx = self.kwcommitctx
-            try:
-                return super(kwrepo, self).commit(*args, **opts)
-            finally:
-                del self.commitctx
-
-        def kwcommitctx(self, ctx, error=False):
-            n = super(kwrepo, self).commitctx(ctx, error)
+        def usercommitctx(self, ctx, error=False):
+            n = super(kwrepo, self).usercommitctx(ctx, error)
             # no lock needed, only called from repo.commit() which already locks
             if not kwt.record:
                 kwt.overwrite(self[n], sorted(ctx.added() + ctx.modified()),


More information about the Mercurial-devel mailing list