diff hgext/color.py @ 31110:7fec37746417

color: add a 'ui.color' option to control color behavior This new option control whether or not color will be used. It mirror the behavior of '--color'. I usually avoid adding new option to '[ui]' as the section is already filled with many option. However, I feel like 'color' is central enough to deserves a spot in this '[ui]' section. For now the option is not documented so it is still marked as experimental. Once it get documented and official, we should be able to deprecate the color extensions. There is more cleanup to do before that documentation is written, but we need this option early to made them. Having that option will allow for more cleanup of the initialisation process and proper separation between color configuration.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Sat, 25 Feb 2017 19:44:23 +0100
parents 45be7590301d
children 268caf97c38f
line wrap: on
line diff
--- a/hgext/color.py	Tue Feb 28 11:42:07 2017 +0100
+++ b/hgext/color.py	Sat Feb 25 19:44:23 2017 +0100
@@ -187,10 +187,11 @@
 
 def extsetup(ui):
     # change default color config
+    color._enabledbydefault = True
     for idx, entry in enumerate(commands.globalopts):
         if entry[1] == 'color':
-            patch = ('auto', entry[3].replace(' (EXPERIMENTAL)', ''))
-            new = entry[:2] + patch + entry[4:]
+            patch = (entry[3].replace(' (EXPERIMENTAL)', ''),)
+            new = entry[:3] + patch + entry[4:]
             commands.globalopts[idx] = new
             break