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.
--- 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)