chg and uisetup
Jun Wu
quark at fb.com
Thu Jul 14 10:36:16 EDT 2016
I see. You are right. Sorry for not reading the code carefully.
Let me re-review all our extensions and if they have unwanted side effects.
Excerpts from Yuya Nishihara's message of 2016-07-14 23:13:10 +0900:
> On Wed, 13 Jul 2016 17:31:40 +0100, Jun Wu wrote:
> > Excerpts from Yuya Nishihara's message of 2016-07-14 00:59:25 +0900:
> > > templatekw.py owns the keywords table. No problem to modify its module-level
> > > variable. See the other use of @templatekeyword and read the docstring.
> >
> > I mean 3rd-party extensions using "@templatekeyword" will have effects
> > on templatekeykw.keywords at import time, which is unwanted.
>
> If they do it wrong, yeah they can modify anything at import time.
>
> Don't:
>
> from mercurial.templatekw import templatekeyword
> @templatekeyword('foo')
> def showfoo(..)
>
> Do:
>
> from mercurial import registrar
> templatekeyword = registrar.templatekeyword()
> @templatekeyword('foo')
> def showfoo(..)
More information about the Mercurial-devel
mailing list