color: show mode warning based on ui.formatted
authorXidorn Quan <me@upsuper.org>
Fri, 11 Nov 2016 13:06:05 +1100
changeset 30377 e193870eb680
parent 30376 038547a14d85
child 30378 ed45283a0ca7
color: show mode warning based on ui.formatted ui.interactive is only for input and ui.formatted is for output.
hgext/color.py
--- a/hgext/color.py	Thu Nov 10 15:14:05 2016 -0500
+++ b/hgext/color.py	Fri Nov 11 13:06:05 2016 +1100
@@ -275,8 +275,8 @@
 
     def modewarn():
         # only warn if color.mode was explicitly set and we're in
-        # an interactive terminal
-        if mode == realmode and ui.interactive():
+        # a formatted terminal
+        if mode == realmode and ui.formatted():
             ui.warn(_('warning: failed to set color mode to %s\n') % mode)
 
     if realmode == 'win32':