# HG changeset patch # User Pierre-Yves David # Date 1493749149 -7200 # Node ID 9a98023ac8dbac13fb03b5369dfaf83145860268 # Parent 9a85ea1daf49b7785b8448834e3e944a14fb991f color: special case 'always' in 'ui.color' This lift the confusing case, where 'ui.color=always' would actually not always use color. diff -r 9a85ea1daf49 -r 9a98023ac8db mercurial/color.py --- a/mercurial/color.py Tue May 02 20:01:54 2017 +0200 +++ b/mercurial/color.py Tue May 02 20:19:09 2017 +0200 @@ -195,8 +195,9 @@ auto = (config == 'auto') always = False if not auto and util.parsebool(config): - # we want the config to behave like a boolean, "on" is actually auto - if ui.configsource('ui', 'color') == '--color': + # We want the config to behave like a boolean, "on" is actually auto, + # but "always" value is treated as a special case to reduce confusion. + if ui.configsource('ui', 'color') == '--color' or config == 'always': always = True else: auto = True diff -r 9a85ea1daf49 -r 9a98023ac8db mercurial/help/config.txt --- a/mercurial/help/config.txt Tue May 02 20:01:54 2017 +0200 +++ b/mercurial/help/config.txt Tue May 02 20:19:09 2017 +0200 @@ -1885,8 +1885,8 @@ ``color`` When to colorize output. Possible value are Boolean ("yes" or "no"), or - "debug". (default: "yes"). "yes" will use color whenever it seems possible. - See :hg:`help color` for details. + "debug", or "always". (default: "yes"). "yes" will use color whenever it + seems possible. See :hg:`help color` for details. ``commitsubrepos`` Whether to commit modified subrepositories when committing the diff -r 9a85ea1daf49 -r 9a98023ac8db tests/test-diff-color.t --- a/tests/test-diff-color.t Tue May 02 20:01:54 2017 +0200 +++ b/tests/test-diff-color.t Tue May 02 20:19:09 2017 +0200 @@ -2,7 +2,7 @@ $ cat <> $HGRCPATH > [ui] - > color = always + > color = yes > formatted = always > [color] > mode = ansi @@ -82,6 +82,22 @@ a c +(check that 'ui.color=always' force color) + + $ hg diff --nodates --config ui.formatted=no --config ui.color=always + \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc) + \x1b[0;31;1m--- a/a\x1b[0m (esc) + \x1b[0;32;1m+++ b/a\x1b[0m (esc) + \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc) + c + a + a + \x1b[0;31m-b\x1b[0m (esc) + \x1b[0;32m+dd\x1b[0m (esc) + a + a + c + --unified=2 $ hg diff --nodates -U 2 diff -r 9a85ea1daf49 -r 9a98023ac8db tests/test-pager-legacy.t --- a/tests/test-pager-legacy.t Tue May 02 20:01:54 2017 +0200 +++ b/tests/test-pager-legacy.t Tue May 02 20:19:09 2017 +0200 @@ -160,8 +160,7 @@ even though stdout is no longer a tty. $ cat >> $HGRCPATH < [ui] - > color = yes - > formatted = yes + > color = always > [color] > mode = ansi > EOF diff -r 9a85ea1daf49 -r 9a98023ac8db tests/test-pager.t --- a/tests/test-pager.t Tue May 02 20:01:54 2017 +0200 +++ b/tests/test-pager.t Tue May 02 20:19:09 2017 +0200 @@ -141,8 +141,7 @@ even though stdout is no longer a tty. $ cat >> $HGRCPATH < [ui] - > color = yes - > formatted = yes + > color = always > [color] > mode = ansi > EOF diff -r 9a85ea1daf49 -r 9a98023ac8db tests/test-status-color.t --- a/tests/test-status-color.t Tue May 02 20:01:54 2017 +0200 +++ b/tests/test-status-color.t Tue May 02 20:19:09 2017 +0200 @@ -1,7 +1,6 @@ $ cat <> $HGRCPATH > [ui] > color = always - > formatted = yes > [color] > mode = ansi > EOF