Mercurial > hg-stable
diff mercurial/dispatch.py @ 31127:7fec37746417
color: add a 'ui.color' option to control color behavior
This new option control whether or not color will be used. It mirror the behavior
of '--color'. I usually avoid adding new option to '[ui]' as the section is
already filled with many option. However, I feel like 'color' is central enough
to deserves a spot in this '[ui]' section.
For now the option is not documented so it is still marked as experimental. Once
it get documented and official, we should be able to deprecate the color
extensions.
There is more cleanup to do before that documentation is written, but we need
this option early to made them. Having that option will allow for more cleanup
of the initialisation process and proper separation between color
configuration.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Sat, 25 Feb 2017 19:44:23 +0100 |
parents | 45be7590301d |
children | 49ad6bf63107 |
line wrap: on
line diff
--- a/mercurial/dispatch.py Tue Feb 28 11:42:07 2017 +0100 +++ b/mercurial/dispatch.py Sat Feb 25 19:44:23 2017 +0100 @@ -765,8 +765,11 @@ ui_.insecureconnections = True # setup color handling + coloropt = options['color'] for ui_ in uis: - color.setup(ui_, options['color']) + if coloropt: + ui_.setconfig('ui', 'color', coloropt, '--color') + color.setup(ui_) if options['version']: return commands.version_(ui)