[PATCH 2 of 5] keyword: wrap usercommitctx() instead of commitctx()
Dan Villiom Podlaski Christiansen
danchr at gmail.com
Fri Jan 6 14:16:05 UTC 2012
# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1325855016 -3600
# Node ID 7e58aafe1d4258735267bb4a0ce580fd14791214
# Parent f3f1a59f7bdba614d3aeeef3423a30105b3f013b
keyword: wrap usercommitctx() instead of commitctx()
This prevents the keyword extension from doing pointless work during
conversions.
Please note that the previoius wrapper wasn't perfect: Martin Geisler
pointed out in issue2254 that it would delete any custom wrappers of
commitctx() inserted into self, such as wrappers installed using
wrapfunction().
diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -570,17 +570,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:
restrict = kwt.restrict
More information about the Mercurial-devel
mailing list