changeset 19063:7ae12ce87594

color: set the ui class in reposetup, before a repo is created Previously only the class of repo.ui was set. The class was set in the wrapper of dispatch._runcommand. But this is called after the repo is created. Only the class of repo.ui is set because repo.baseui already exists and is not accessible. We now set the class in uisetup because this is called before repo creation. This is also the place suggested in the wiki for modifying classes.
author Simon Heimberg <simohe@besonet.ch>
date Thu, 18 Apr 2013 23:53:24 +0200
parents 365b0de17c1c
children 743daa601445
files hgext/color.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Thu Apr 18 20:28:38 2013 +0200
+++ b/hgext/color.py	Thu Apr 18 23:53:24 2013 +0200
@@ -381,13 +381,13 @@
 def uisetup(ui):
     if ui.plain():
         return
+    if not issubclass(ui.__class__, colorui):
+        colorui.__bases__ = (ui.__class__,)
+        ui.__class__ = colorui
     def colorcmd(orig, ui_, opts, cmd, cmdfunc):
         mode = _modesetup(ui_, opts)
         if mode:
             colorui._colormode = mode
-            if not issubclass(ui_.__class__, colorui):
-                colorui.__bases__ = (ui_.__class__,)
-                ui_.__class__ = colorui
             extstyles()
             configstyles(ui_)
         return orig(ui_, opts, cmd, cmdfunc)