[PATCH] keyword: make repo.commit use a custom commitctx wrapper

Christian Ebert blacktrash at gmx.net
Thu Jul 2 04:18:09 CDT 2009

* Christian Ebert on Tuesday, June 30, 2009 at 10:13:28 -0000
> # HG changeset patch
> # User Christian Ebert <blacktrash at gmx.net>
> # Date 1246354203 -7200
> # Node ID 02f1d60fe9bf5274d5b4cf409963815694c24338
> # Parent  bacb06d1e8b60b6083e3139fc5fb23355612eef8
> keyword: make repo.commit use a custom commitctx wrapper


A question about my own patch ;-)

> @@ -460,8 +461,14 @@
>         def commit(self, text='', user=None, date=None, match=None,
>                    force=False, editor=None, extra={}):
> +            # use custom commitctx for user commands
> +            # other extensions can still wrap repo.commitctx directly
> +            repo.commitctx = self.kwcommitctx

The above line works also as:

             self.commitctx = self.kwcommitctx


In reposetup(ui, repo) I override the repo class:

    class kwrepo(repo.__class__):

and later on do things like:
        lock = self.wlock()

even though wlock is not defined in kwrepo. Playing around with
pylint, it complained about that "kwrepo has no wlock member",
but felt better after I changed the above to

        lock = repo.wlock()

as it would have complained if I had

             self.commitctx = self.kwcommitctx

instead of

             repo.commitctx = self.kwcommitctx

in my patch. 

mq does something similar and uses self consistently (with pylint
complaining accordingly). Which is the way to go? Is there a
difference wrt to safety? According to test-keyword it doesn't
make a difference, but which way should I choose for consistency?

\black\trash movie    _C O W B O Y_  _C A N O E_  _C O M A_
Ein deutscher Western/A German Western
-->> http://www.blacktrash.org/underdogma/ccc.html
-->> http://www.blacktrash.org/underdogma/ccc-en.html

More information about the Mercurial-devel mailing list