diff --git a/mercurial/color.py b/mercurial/color.py --- a/mercurial/color.py +++ b/mercurial/color.py @@ -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': diff --git a/tests/test-status-color.t b/tests/test-status-color.t --- a/tests/test-status-color.t +++ b/tests/test-status-color.t @@ -29,6 +29,22 @@ [status.unknown|? ][status.unknown|b/2/in_b_2] [status.unknown|? ][status.unknown|b/in_b] [status.unknown|? ][status.unknown|in_root] +HGPLAIN disables color + $ HGPLAIN=1 hg status --color=debug + ? a/1/in_a_1 + ? a/in_a + ? b/1/in_b_1 + ? b/2/in_b_2 + ? b/in_b + ? in_root +HGPLAINEXCEPT=color does not disable color + $ HGPLAINEXCEPT=color hg status --color=debug + [status.unknown|? ][status.unknown|a/1/in_a_1] + [status.unknown|? ][status.unknown|a/in_a] + [status.unknown|? ][status.unknown|b/1/in_b_1] + [status.unknown|? ][status.unknown|b/2/in_b_2] + [status.unknown|? ][status.unknown|b/in_b] + [status.unknown|? ][status.unknown|in_root] hg status with template $ hg status -T "{label('red', path)}\n" --color=debug