# HG changeset patch # User Pierre-Yves David # Date 1487697727 -3600 # Node ID a185b903bda3c64678d1f9399bfa0be8d326dbff # Parent 45be7590301d3bc3757800311475f78bcd0d8974 color: have the 'ui' object carry the '_colormode' directly Before this changeset, the value was carried by the class to work around limitation of the extensions initialisation. Now that the initialisation is cleanly handled in 'dispatch', we can drop this work around. diff -r 45be7590301d -r a185b903bda3 mercurial/color.py --- a/mercurial/color.py Tue Feb 21 18:20:12 2017 +0100 +++ b/mercurial/color.py Tue Feb 21 18:22:07 2017 +0100 @@ -168,7 +168,7 @@ argument. That function both set the colormode for the ui object and read the configuration looking for custom colors and effect definitions.""" mode = _modesetup(ui, coloropts) - ui.__class__._colormode = mode + ui._colormode = mode if mode and mode != 'debug': configstyles(ui) diff -r 45be7590301d -r a185b903bda3 mercurial/ui.py --- a/mercurial/ui.py Tue Feb 21 18:20:12 2017 +0100 +++ b/mercurial/ui.py Tue Feb 21 18:22:07 2017 +0100 @@ -128,8 +128,6 @@ raise error.SignalInterrupt class ui(object): - # color mode: see mercurial/color.py for possible value - _colormode = None def __init__(self, src=None): """Create a fresh new ui object if no src given @@ -157,6 +155,8 @@ self.insecureconnections = False # Blocked time self.logblockedtimes = False + # color mode: see mercurial/color.py for possible value + self._colormode = None if src: self.fout = src.fout @@ -173,6 +173,8 @@ self.environ = src.environ self.callhooks = src.callhooks self.insecureconnections = src.insecureconnections + self._colormode = src._colormode + self.fixconfig() self.httppasswordmgrdb = src.httppasswordmgrdb