[PATCH STABLE] help: add example of '[templates]' usage
Anton Shestakov
engored at ya.ru
Mon Aug 8 11:47:28 EDT 2016
08.08.2016, 22:53, "Mathias De Mar" <mathias.demare at gmail.com>:
> # 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: superfluous line break.
> +
> +For example,
> +
> +::
> +
> + [templates]
> + short = "{shortest(node, 8)}"
Nit: minlength of 8 is not very useful at all, here's what it's like on the hg repo:
$ hg log -T '{shortest(node, 8)|count}\n' | sort -u
8
So it's literally just wasting time checking that the first 8 characters are unique (and they all are for almost 30k changesets). smartlog template uses the default minlength of 4. Bitbucket, for example, shows just first 7 symbols (without any checks that shortest() does, even).
> +
> +defines a template, ``short``, which can be called like::
> +
> + $ hg log -r . -Tshort
> +
It probably should point out the difference between templatealias and templates.
(hg help config also doesn't mention [templates], only web.templates)
More information about the Mercurial-devel
mailing list