[PATCH 2 of 2 V2] templater: add '{envvars}' to access environment variables
Yuya Nishihara
yuya at tcha.org
Wed Jan 18 08:44:55 EST 2017
On Tue, 17 Jan 2017 23:50:47 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1484712774 18000
> # Tue Jan 17 23:12:54 2017 -0500
> # Node ID fce42f9dba7bab71463c0bcec44e6d87fdf275b2
> # Parent 5a03e25ec0c0417e915b2014995bd83443ef97ec
> templater: add '{envvars}' to access environment variables
>
> Since the option for ui.exportableenviron is experimental, so is this template
> until the underlying API is sorted out.
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -1448,7 +1448,8 @@
> 'parent': '{rev}:{node|formatnode} ',
> 'manifest': '{rev}:{node|formatnode}',
> 'file_copy': '{name} ({source})',
> - 'extra': '{key}={value|stringescape}'
> + 'extra': '{key}={value|stringescape}',
> + 'envvar': '{key}={value|stringescape}'
Dropped '|stringescape' since {envvar} should be readable text in general.
> --- a/mercurial/templatekw.py
> +++ b/mercurial/templatekw.py
> @@ -303,6 +303,18 @@
> maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
> return '%s: +%s/-%s' % (len(stats), adds, removes)
>
> + at templatekeyword('envvars')
> +def showenviron(repo, **args):
s/showenviron/showenvvars/
More information about the Mercurial-devel
mailing list