diff mercurial/color.py @ 32103:9a98023ac8db stable

color: special case 'always' in 'ui.color' This lift the confusing case, where 'ui.color=always' would actually not always use color.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 02 May 2017 20:19:09 +0200
parents 9a85ea1daf49
children bd872f64a8ba
line wrap: on
line diff
--- 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