color: handle 'ui.plain()' directly in mode setup
If 'ui.plain()' is set we should not colorize. We move that logic into the
function that determine and setup the color mode. As all other code respect
the resulting mode this will be equivalent.
--- a/hgext/color.py Tue Feb 21 17:50:04 2017 +0100
+++ b/hgext/color.py Tue Feb 21 17:51:43 2017 +0100
@@ -189,8 +189,6 @@
testedwith = 'ships-with-hg-core'
def uisetup(ui):
- if ui.plain():
- return
def colorcmd(orig, ui_, opts, cmd, cmdfunc):
mode = color._modesetup(ui_, opts['color'])
uimod.ui._colormode = mode
--- a/mercurial/color.py Tue Feb 21 17:50:04 2017 +0100
+++ b/mercurial/color.py Tue Feb 21 17:51:43 2017 +0100
@@ -162,6 +162,8 @@
_terminfo_params.clear()
def _modesetup(ui, coloropt):
+ if ui.plain():
+ return None
if coloropt == 'debug':
return 'debug'