diff mercurial/color.py @ 35181:d4805a5e7e70

color: respect HGPLAINEXCEPT=color to allow colors while scripting (issue5749) I'd also like --color=always on the command-line to override HGPLAIN=1 et al, but that's more work, and this seems like a better fix. We've got a fair number of programs that actually want to automate hg and get colored output to users, so they should set HGPLAINEXCEPT=alias (what we usually recommend), but this has been breaking them because they then lose color. .. feature:: The ``HGPLAINEXCEPT`` environment variable can now include ``color`` to allow automatic output colorization in otherwise automated environments. Differential Revision: https://phab.mercurial-scm.org/D1532
author Augie Fackler <augie@google.com>
date Tue, 28 Nov 2017 13:27:43 -0500
parents 75979c8d4572
children 6ba79cf34f5e
line wrap: on
line diff
--- a/mercurial/color.py	Sun Nov 26 11:22:27 2017 +0900
+++ b/mercurial/color.py	Tue Nov 28 13:27:43 2017 -0500
@@ -181,7 +181,7 @@
         configstyles(ui)
 
 def _modesetup(ui):
-    if ui.plain():
+    if ui.plain('color'):
         return None
     config = ui.config('ui', 'color')
     if config == 'debug':