chg and uisetup

Yuya Nishihara yuya at tcha.org
Thu Jul 14 10:13:10 EDT 2016


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