# HG changeset patch # User Simon Heimberg # Date 1366322004 -7200 # Node ID 7ae12ce875946e0951661fc29590cc80fd0738bd # Parent 365b0de17c1cd6c891e9207b9dd922739cdea958 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. diff -r 365b0de17c1c -r 7ae12ce87594 hgext/color.py --- 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)