# HG changeset patch # User Martin von Zweigbergk # Date 1605289309 28800 # Node ID 8357e0e81bb7950eaf9a33624c073f32e1a1d713 # Parent c10683da688952f58d3ee75e0b022bbb8c4d4b16 split: disable color while rendering template for use in commit message Differential Revision: https://phab.mercurial-scm.org/D9322 diff -r c10683da6889 -r 8357e0e81bb7 hgext/split.py --- a/hgext/split.py Thu Nov 12 17:06:45 2020 -0800 +++ b/hgext/split.py Fri Nov 13 09:41:49 2020 -0800 @@ -142,9 +142,14 @@ header = _( b'HG: Splitting %s. So far it has been split into:\n' ) % short(ctx.node()) - for c in committed: - summary = cmdutil.format_changeset_summary(ui, c, b'split') - header += _(b'HG: - %s\n') % summary + # 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'split' + ): + for c in committed: + summary = cmdutil.format_changeset_summary(ui, c, b'split') + header += _(b'HG: - %s\n') % summary header += _( b'HG: Write commit message for the next split changeset.\n' ) diff -r c10683da6889 -r 8357e0e81bb7 tests/test-split.t --- a/tests/test-split.t Thu Nov 12 17:06:45 2020 -0800 +++ b/tests/test-split.t Fri Nov 13 09:41:49 2020 -0800 @@ -1031,7 +1031,7 @@ (enter ? for help) [Ynesfdaq?]] [ ui.promptecho|a] EDITOR: HG: Splitting 6432c65c3078. So far it has been split into: - EDITOR: HG: - [rev|2] split2, modifying file2 + EDITOR: HG: - 2 split2, modifying file2 EDITOR: HG: Write commit message for the next split changeset. EDITOR: split1, modifying file1 EDITOR: