# HG changeset patch # User Yuya Nishihara # Date 2016-03-27 12:05:55 # Node ID 77e566fe31ec0421a5f78d155f660503eb4d2a81 # Parent d813132ea3611cd6e72102cbe9ce8e2474e060a7 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}'