[PATCH 9 of 9] ui: drop template aliases by HGPLAIN
Yuya Nishihara
yuya at tcha.org
Fri Apr 15 09:15:48 EDT 2016
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1459080355 -32400
# Sun Mar 27 21:05:55 2016 +0900
# Node ID 1b182b6e357ccc59fc30967630d4b150e038d2e7
# Parent 2c175aa76db0df4ecfd89861215d6dbd226329eb
ui: drop template aliases by HGPLAIN
Otherwise, scripting output could be suffered from user aliases.
diff --git a/mercurial/help/environment.txt b/mercurial/help/environment.txt
--- a/mercurial/help/environment.txt
+++ b/mercurial/help/environment.txt
@@ -69,6 +69,8 @@ HGPLAINEXCEPT
Preserve internationalization.
``revsetalias``
Don't remove revset aliases.
+ ``templatealias``
+ Don't remove template aliases.
``progress``
Don't hide progress output.
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -192,6 +192,9 @@ class ui(object):
if self.plain('revsetalias'):
for k, v in cfg.items('revsetalias'):
del cfg['revsetalias'][k]
+ if self.plain('templatealias'):
+ for k, v in cfg.items('templatealias'):
+ del cfg['templatealias'][k]
if trusted:
self._tcfg.update(cfg)
diff --git a/tests/test-command-template.t b/tests/test-command-template.t
--- a/tests/test-command-template.t
+++ b/tests/test-command-template.t
@@ -3756,6 +3756,13 @@ Aliases in formatter:
default 6:d41e714fe50d
foo 4:bbe44766e73d
+Aliases should honor HGPLAIN:
+
+ $ HGPLAIN= hg log -r0 -T 'nothing expanded:{rn}\n'
+ nothing expanded:
+ $ HGPLAINEXCEPT=templatealias hg log -r0 -T '{rn}\n'
+ 0:1e4e1b8f71e0
+
Unparsable alias:
$ hg debugtemplate --config templatealias.bad='x(' -v '{bad}'
More information about the Mercurial-devel
mailing list