[PATCH STABLE] help: add example of '[templates]' usage

Yuya Nishihara yuya at tcha.org
Mon Aug 8 11:48:10 EDT 2016


On Mon, 08 Aug 2016 09:53:05 -0500, Mathias De Maré wrote:
> # HG changeset patch
> # User Mathias De Maré <mathias.demare at gmail.com>
> # Date 1470667662 -7200
> #      Mon Aug 08 16:47:42 2016 +0200
> # Branch stable
> # Node ID bbcf7bff5bac8b56b61942a50a562f0d45448297
> # Parent  b8f9cdca88077e97d4869320b9d18481fbe252ef
> help: add example of '[templates]' usage
> 
> diff --git a/mercurial/help/templates.txt b/mercurial/help/templates.txt
> --- a/mercurial/help/templates.txt
> +++ b/mercurial/help/templates.txt
> @@ -71,6 +71,21 @@
>  defines two symbol aliases, ``r`` and ``rn``, and a function alias
>  ``leftpad()``.
>  
> +It's also possible to specify entirely new template commands,
> +using the ``templates`` section.
> +The syntax is the same as with ``templatealias``.

Nit: they aren't exactly the same. Aliases are expressions, but templates
are template strings, e.g.

  [templatealias]
  # function = function
  utcdate(date) = localdate(date, "UTC")
  # keyword = '"' template-string '"' ('"' starts a template string)
  revnode = "{rev}:{node|short}"

  [templates]
  # name = template-string (optionally quoted)
  short = "{shortest(node, 8)}"

Maybe we can say "the same as ``ui.logtemplate``."


More information about the Mercurial-devel mailing list