[PATCH 4 of 5] extdata: add basic template support
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Fri Sep 23 22:23:25 UTC 2016
On 09/22/2016 08:21 PM, Matt Mackall wrote:
> # HG changeset patch
> # User Matt Mackall <mpm at selenic.com>
> # Date 1474294560 18000
> # Mon Sep 19 09:16:00 2016 -0500
> # Node ID 6db1b2e7d19ed317404c1275db46780d40ececb8
> # Parent 133b35066bef5d9c31d13c4f0b2e4a50d1ceae87
> extdata: add basic template support
>
> This lets us expose the per-entry "freeform data".
I guess the same feedback apply here. Maybe we should go for a single
generic template name (with argument) and let user create alias if they
really needs to. What do you think?
> Again, the registrar framework isn't a good fit
I think the registrar framework is mostly intended for extensions. Where
the module is loaded for sure and adding new template/revset requires to
access with the internal data structure.
> diff -r 133b35066bef -r 6db1b2e7d19e mercurial/templater.py
> --- a/mercurial/templater.py Mon Sep 19 09:13:11 2016 -0500
> +++ b/mercurial/templater.py Mon Sep 19 09:16:00 2016 -0500
> @@ -19,6 +19,7 @@
> parser,
> registrar,
> revset as revsetmod,
> + scmutil,
> templatefilters,
> templatekw,
> util,
> @@ -352,6 +353,13 @@
> try:
> v = context.process(key, safemapping)
> except TemplateNotFound:
> + # check for extdata last
> + if 'ctx' in mapping:
> + ctx = mapping['ctx']
Could we use 'get' here:
ctx = mapping.get('ctx')
if ctx is not None:
Cheers,
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list