# HG changeset patch # User Pierre-Yves David <pierre-yves.da...@ens-lyon.org> # Date 1487695903 -3600 # Tue Feb 21 17:51:43 2017 +0100 # Node ID 1b39bb158cdb97965da0b614b7c8bcd6a8b58887 # Parent 81c3db1bc60255c7a5a1455106f4fb69b96b3658 # EXP-Topic color 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. diff -r 81c3db1bc602 -r 1b39bb158cdb hgext/color.py --- 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 @@ command = cmdutil.command(cmdtable) 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 diff -r 81c3db1bc602 -r 1b39bb158cdb mercurial/color.py --- 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 @@ def _terminfosetup(ui, mode): _terminfo_params.clear() def _modesetup(ui, coloropt): + if ui.plain(): + return None if coloropt == 'debug': return 'debug' _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel