Mercurial > hg
diff hgext/convert/__init__.py @ 28540:012411b9940d
hgext: use templatekeyword to mark a function as template keyword
This patch replaces registration of template keyword function in
bundled extensions by registrar.templatekeyword decorator all at once.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 13 Mar 2016 05:17:06 +0900 |
parents | 4817c17a11a2 |
children | a0939666b836 |
line wrap: on
line diff
--- a/hgext/convert/__init__.py Sun Mar 13 05:17:06 2016 +0900 +++ b/hgext/convert/__init__.py Sun Mar 13 05:17:06 2016 +0900 @@ -11,7 +11,7 @@ from mercurial import ( cmdutil, - templatekw, + registrar, ) from mercurial.i18n import _ @@ -437,22 +437,22 @@ return subversion.revsplit(rev)[0] return rev +templatekeyword = registrar.templatekeyword() + +@templatekeyword('svnrev') def kwsvnrev(repo, ctx, **args): - """:svnrev: String. Converted subversion revision number.""" + """String. Converted subversion revision number.""" return kwconverted(ctx, 'svnrev') +@templatekeyword('svnpath') def kwsvnpath(repo, ctx, **args): - """:svnpath: String. Converted subversion revision project path.""" + """String. Converted subversion revision project path.""" return kwconverted(ctx, 'svnpath') +@templatekeyword('svnuuid') def kwsvnuuid(repo, ctx, **args): - """:svnuuid: String. Converted subversion revision repository identifier.""" + """String. Converted subversion revision repository identifier.""" return kwconverted(ctx, 'svnuuid') -def extsetup(ui): - templatekw.keywords['svnrev'] = kwsvnrev - templatekw.keywords['svnpath'] = kwsvnpath - templatekw.keywords['svnuuid'] = kwsvnuuid - # tell hggettext to extract docstrings from these functions: i18nfunctions = [kwsvnrev, kwsvnpath, kwsvnuuid]