[PATCH 3 of 6 v2] keyword: wrap commitworkingctx() instead of commitctx()
Dan Villiom Podlaski Christiansen
danchr at gmail.com
Sun Jan 8 07:37:53 CST 2012
# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1326029593 -3600
# Node ID e9165a512b0d4b6a6800c2b70a3d13035573cbf9
# Parent c8d89b1996ac78aabf8bf7c31d6bdeb012c72db5
keyword: wrap commitworkingctx() 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 commitworkingctx(self, ctx, error=False):
+ n = super(kwrepo, self).commitworkingctx(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