color: initialize color for the localrepo ui
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Sat, 25 Feb 2017 18:34:01 +0100
changeset 31111 95ec3ad62f62
parent 31110 7fec37746417
child 31112 7f056fdbe37e
color: initialize color for the localrepo ui The 'ui' object dedicated to a 'localrepo' is independent from the one available in dispatch (and 'uisetup'). In addition, it is created from the 'baseui' (apparently for good reason). As a result, we need to run the color setup on it after the local repository config is read. This was overlooked when the rest of the initialization changed but did not had impact yet because all setup is still global. We fix it before it is too late.
mercurial/localrepo.py
tests/test-status-color.t
--- a/mercurial/localrepo.py	Sat Feb 25 19:44:23 2017 +0100
+++ b/mercurial/localrepo.py	Sat Feb 25 18:34:01 2017 +0100
@@ -28,6 +28,7 @@
     bundle2,
     changegroup,
     changelog,
+    color,
     context,
     dirstate,
     dirstateguard,
@@ -285,6 +286,7 @@
                     setupfunc(self.ui, self.supported)
         else:
             self.supported = self._basesupported
+        color.setup(self.ui)
 
         # Add compression engines.
         for name in util.compengines:
--- a/tests/test-status-color.t	Sat Feb 25 19:44:23 2017 +0100
+++ b/tests/test-status-color.t	Sat Feb 25 18:34:01 2017 +0100
@@ -296,6 +296,7 @@
   $ hg --config color.status.modified=periwinkle status
   ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
   ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
+  ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
   M modified
   \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
   \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)