##// END OF EJS Templates
hgext: use templatekeyword to mark a function as template keyword...
FUJIWARA Katsunori -
r28540:012411b9 default
parent child Browse files
Show More
@@ -11,7 +11,7 b' from __future__ import absolute_import'
11
11
12 from mercurial import (
12 from mercurial import (
13 cmdutil,
13 cmdutil,
14 templatekw,
14 registrar,
15 )
15 )
16 from mercurial.i18n import _
16 from mercurial.i18n import _
17
17
@@ -437,22 +437,22 b' def kwconverted(ctx, name):'
437 return subversion.revsplit(rev)[0]
437 return subversion.revsplit(rev)[0]
438 return rev
438 return rev
439
439
440 templatekeyword = registrar.templatekeyword()
441
442 @templatekeyword('svnrev')
440 def kwsvnrev(repo, ctx, **args):
443 def kwsvnrev(repo, ctx, **args):
441 """:svnrev: String. Converted subversion revision number."""
444 """String. Converted subversion revision number."""
442 return kwconverted(ctx, 'svnrev')
445 return kwconverted(ctx, 'svnrev')
443
446
447 @templatekeyword('svnpath')
444 def kwsvnpath(repo, ctx, **args):
448 def kwsvnpath(repo, ctx, **args):
445 """:svnpath: String. Converted subversion revision project path."""
449 """String. Converted subversion revision project path."""
446 return kwconverted(ctx, 'svnpath')
450 return kwconverted(ctx, 'svnpath')
447
451
452 @templatekeyword('svnuuid')
448 def kwsvnuuid(repo, ctx, **args):
453 def kwsvnuuid(repo, ctx, **args):
449 """:svnuuid: String. Converted subversion revision repository identifier."""
454 """String. Converted subversion revision repository identifier."""
450 return kwconverted(ctx, 'svnuuid')
455 return kwconverted(ctx, 'svnuuid')
451
456
452 def extsetup(ui):
453 templatekw.keywords['svnrev'] = kwsvnrev
454 templatekw.keywords['svnpath'] = kwsvnpath
455 templatekw.keywords['svnuuid'] = kwsvnuuid
456
457 # tell hggettext to extract docstrings from these functions:
457 # tell hggettext to extract docstrings from these functions:
458 i18nfunctions = [kwsvnrev, kwsvnpath, kwsvnuuid]
458 i18nfunctions = [kwsvnrev, kwsvnpath, kwsvnuuid]
@@ -32,7 +32,6 b' from mercurial import ('
32 revlog,
32 revlog,
33 revset,
33 revset,
34 scmutil,
34 scmutil,
35 templatekw,
36 util,
35 util,
37 )
36 )
38
37
@@ -726,14 +725,16 b' def revsettransplanted(repo, subset, x):'
726 return revset.baseset([r for r in s if
725 return revset.baseset([r for r in s if
727 repo[r].extra().get('transplant_source')])
726 repo[r].extra().get('transplant_source')])
728
727
728 templatekeyword = registrar.templatekeyword()
729
730 @templatekeyword('transplanted')
729 def kwtransplanted(repo, ctx, **args):
731 def kwtransplanted(repo, ctx, **args):
730 """:transplanted: String. The node identifier of the transplanted
732 """String. The node identifier of the transplanted
731 changeset if any."""
733 changeset if any."""
732 n = ctx.extra().get('transplant_source')
734 n = ctx.extra().get('transplant_source')
733 return n and nodemod.hex(n) or ''
735 return n and nodemod.hex(n) or ''
734
736
735 def extsetup(ui):
737 def extsetup(ui):
736 templatekw.keywords['transplanted'] = kwtransplanted
737 cmdutil.unfinishedstates.append(
738 cmdutil.unfinishedstates.append(
738 ['transplant/journal', True, False, _('transplant in progress'),
739 ['transplant/journal', True, False, _('transplant in progress'),
739 _("use 'hg transplant --continue' or 'hg update' to abort")])
740 _("use 'hg transplant --continue' or 'hg update' to abort")])
General Comments 0
You need to be logged in to leave comments. Login now