diff hgext/color.py @ 30971:bb6385882cfa

color: move configstyles into the core module The extension is getting thinner as we speak!
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 22 Dec 2016 02:34:22 +0100
parents ddc80d1777a6
children a3c7e42c7a1f
line wrap: on
line diff
--- a/hgext/color.py	Thu Dec 22 02:30:03 2016 +0100
+++ b/hgext/color.py	Thu Dec 22 02:34:22 2016 +0100
@@ -332,22 +332,6 @@
         stop = _effect_str('none')
     return ''.join([start, text, stop])
 
-def configstyles(ui):
-    for status, cfgeffects in ui.configitems('color'):
-        if '.' not in status or status.startswith(('color.', 'terminfo.')):
-            continue
-        cfgeffects = ui.configlist('color', status)
-        if cfgeffects:
-            good = []
-            for e in cfgeffects:
-                if color.valideffect(e):
-                    good.append(e)
-                else:
-                    ui.warn(_("ignoring unknown color/effect %r "
-                              "(configured in color.%s)\n")
-                            % (e, status))
-            color._styles[status] = ' '.join(good)
-
 class colorui(uimod.ui):
     _colormode = 'ansi'
     def write(self, *args, **opts):
@@ -420,7 +404,7 @@
         mode = _modesetup(ui_, opts['color'])
         colorui._colormode = mode
         if mode and mode != 'debug':
-            configstyles(ui_)
+            color.configstyles(ui_)
         return orig(ui_, opts, cmd, cmdfunc)
     def colorgit(orig, gitsub, commands, env=None, stream=False, cwd=None):
         if gitsub.ui._colormode and len(commands) and commands[0] == "diff":