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

Christian Ebert blacktrash at gmx.net
Sat Jan 7 02:16:33 CST 2012


* Dan Villiom Podlaski Christiansen on Friday, January 06, 2012 at 15:16:05 +0100
> # 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.

If by "conversions" you mean hg convert, are you aware that the
extension does not do anything when hg convert is run?
(not meant as argument against the patch)

> 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

-- 
  Was heißt hier Dogma, ich bin Underdogma!
[ What the hell do you mean dogma, I am underdogma. ]
free movies       --->>> http://www.blacktrash.org/underdogma
http://itunes.apple.com/podcast/underdogma-movies/id363423596


More information about the Mercurial-devel mailing list