Mercurial > hg-stable
changeset 45873:62983988bbf5
histedit: disable color while rendering template for use in plan
Differential Revision: https://phab.mercurial-scm.org/D9324
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 16 Nov 2020 10:30:53 -0800 |
parents | ec6ba70be853 |
children | 781b09790633 |
files | hgext/histedit.py tests/test-histedit-commute.t |
diffstat | 2 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/histedit.py Mon Nov 16 10:30:06 2020 -0800 +++ b/hgext/histedit.py Mon Nov 16 10:30:53 2020 -0800 @@ -525,7 +525,11 @@ """ ctx = self.repo[self.node] ui = self.repo.ui - with ui.configoverride({}, b'histedit'): + # We don't want color codes in the commit message template, so + # disable the label() template function while we render it. + with ui.configoverride( + {(b'templatealias', b'label(l,x)'): b"x"}, b'histedit' + ): summary = cmdutil.rendertemplate( ctx, ui.config(b'histedit', b'summary-template') )
--- a/tests/test-histedit-commute.t Mon Nov 16 10:30:06 2020 -0800 +++ b/tests/test-histedit-commute.t Mon Nov 16 10:30:53 2020 -0800 @@ -107,10 +107,10 @@ colors in the custom template don't show up in the editor $ HGEDITOR=cat hg histedit 177f92b77385 --color=debug \ > --config histedit.summary-template='I am rev {label("rev", rev)}' - pick 177f92b77385 I am rev [rev|2] - pick 055a42cdd887 I am rev [rev|3] - pick e860deea161a I am rev [rev|4] - pick 652413bf663e I am rev [rev|5] + pick 177f92b77385 I am rev 2 + pick 055a42cdd887 I am rev 3 + pick e860deea161a I am rev 4 + pick 652413bf663e I am rev 5 # Edit history between 177f92b77385 and 652413bf663e #