This instance will be upgraded to Heptapod 0.21.0rc3 on 2021-04-23 at 10:30 UTC+2 (a few minutes of down time)

Commit baa3662d authored by Martin von Zweigbergk's avatar Martin von Zweigbergk

tests: show how `hg split` can put color codes in commit template

With D9255, I made it so `hg split` respects the
`commmand-templates.oneline-summary` config. I don't think I realized
that the output I modified was being put in a commit message
template. The result was that if you have coloring enabled, you get
colors in the commit template. This patch show that. The test is
unfortunately pretty verbose (like most other `hg split` tests) and
shows a bunch of irrelevant "color codes" (templater labels).

Differential Revision: https://phab.mercurial-scm.org/D9321
parent 4b4160a83303
......@@ -976,3 +976,73 @@ accidentally.
2
3
4
Test that color codes don't end up in the commit message template
----------------------------------------------------
$ hg init $TESTTMP/colorless
$ cd $TESTTMP/colorless
$ echo 1 > file1
$ echo 1 > file2
$ hg ci -qAm initial
$ echo 2 > file1
$ echo 2 > file2
$ cat > $TESTTMP/messages <<EOF
> split1, modifying file1
> --
> split2, modifying file2
> EOF
$ hg ci
EDITOR:
EDITOR:
EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
EDITOR: HG: Leave message empty to abort commit.
EDITOR: HG: --
EDITOR: HG: user: test
EDITOR: HG: branch 'default'
EDITOR: HG: changed file1
EDITOR: HG: changed file2
$ printf 'f\nn\na\n' | hg split --color=debug \
> --config command-templates.oneline-summary='{label("rev", rev)} {desc}'
[diff.diffline|diff --git a/file1 b/file1]
1 hunks, 1 lines changed
[ ui.prompt|examine changes to 'file1'?
(enter ? for help) [Ynesfdaq?]] [ ui.promptecho|f]
[diff.diffline|diff --git a/file2 b/file2]
1 hunks, 1 lines changed
[ ui.prompt|examine changes to 'file2'?
(enter ? for help) [Ynesfdaq?]] [ ui.promptecho|n]
EDITOR: HG: Splitting 6432c65c3078. Write commit message for the first split changeset.
EDITOR: split1, modifying file1
EDITOR:
EDITOR:
EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
EDITOR: HG: Leave message empty to abort commit.
EDITOR: HG: --
EDITOR: HG: user: test
EDITOR: HG: branch 'default'
EDITOR: HG: changed file1
[ ui.status|created new head]
[diff.diffline|diff --git a/file2 b/file2]
1 hunks, 1 lines changed
[ ui.prompt|examine changes to 'file2'?
(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: Write commit message for the next split changeset.
EDITOR: split1, modifying file1
EDITOR:
EDITOR:
EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
EDITOR: HG: Leave message empty to abort commit.
EDITOR: HG: --
EDITOR: HG: user: test
EDITOR: HG: branch 'default'
EDITOR: HG: changed file2
[ ui.warning|transaction abort!]
[ ui.warning|rollback completed]
[ ui.error|abort: empty commit message]
[10]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment