[PATCH 4 of 4 evolve-ext] evolve: use registrar.templatekeyword to register template keyword functions

Boris Feld boris.feld at octobus.net
Thu Sep 14 15:03:24 EDT 2017


Thank you for your patches, they have been accepted.

On Fri, 2017-09-15 at 01:33 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1502115761 -32400
> #      Mon Aug 07 23:22:41 2017 +0900
> # Node ID d24bf49080b751520b734482936566da7421de12
> # Parent  dea894973e8faddafe06cc53fbfe6a4f109c3143
> # Available At https://foozy@bitbucket.org/foozy/hgext-evolve
> #              hg pull https://foozy@bitbucket.org/foozy/hgext-evolve
>  -r d24bf49080b7
> # EXP-Topic doc-improvement
> evolve: use registrar.templatekeyword to register template keyword
> functions
> 
> Now, using registrar.templatekeyword of Mercurial directly in evolve
> extension should be safe enough. because it has been available since
> Mercurial 3.8, and minimum Mercurial version for evolve extension is
> 3.8, too.
> 
> BTW, this also fixes an issue of "hg help templates" output that
> template keywords "precursors" and "successors" are not displayed as
> same as others, because they do not have ":KEYWORD:" prefix in their
> docstring.
> 
> diff --git a/hgext3rd/evolve/exthelper.py
> b/hgext3rd/evolve/exthelper.py
> --- a/hgext3rd/evolve/exthelper.py
> +++ b/hgext3rd/evolve/exthelper.py
> @@ -99,8 +99,11 @@ class exthelper(object):
>              revsetpredicate(name)(symbol)
>          revset.loadpredicate(ui, 'evolve', revsetpredicate)
>  
> +        templatekeyword = registrar.templatekeyword()
>          for name, kw in self._templatekws:
> -            templatekw.keywords[name] = kw
> +            templatekeyword(name)(kw)
> +        templatekw.loadkeyword(ui, 'evolve', templatekeyword)
> +
>          for ext, command, wrapper, opts in self._extcommandwrappers:
>              if ext not in knownexts:
>                  try:
> diff --git a/hgext3rd/evolve/templatekw.py
> b/hgext3rd/evolve/templatekw.py
> --- a/hgext3rd/evolve/templatekw.py
> +++ b/hgext3rd/evolve/templatekw.py
> @@ -28,7 +28,7 @@ eh = exthelper.exthelper()
>  
>  @eh.templatekw('obsolete')
>  def obsoletekw(repo, ctx, templ, **args):
> -    """:obsolete: String. Whether the changeset is ``obsolete``.
> +    """String. Whether the changeset is ``obsolete``.
>      """
>      if ctx.obsolete():
>          return 'obsolete'
> @@ -36,7 +36,7 @@ def obsoletekw(repo, ctx, templ, **args)
>  
>  @eh.templatekw('troubles')
>  def showtroubles(**args):
> -    """:troubles: List of strings. Evolution troubles affecting the
> changeset
> +    """List of strings. Evolution troubles affecting the changeset
>      (zero or more of "unstable", "divergent" or "bumped")."""
>      ctx = args['ctx']
>      try:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list