diff hgext/color.py @ 14516:842a9179132c

color: check if ui is already a subclass of colorui before wrapping it since it's possible to reuse the ui object (see 80c599eee3f3) between dispatch calls, the ui might have been wrapped already. we could probably move this test up a bit but leaving it here allows updates to take effect by extstyles() and configstyles().
author Idan Kamara <idankk86@gmail.com>
date Thu, 02 Jun 2011 00:43:34 +0300
parents ad6ad51cc0dd
children 1e6661e09818
line wrap: on
line diff
--- a/hgext/color.py	Thu Jun 02 00:43:34 2011 +0300
+++ b/hgext/color.py	Thu Jun 02 00:43:34 2011 +0300
@@ -349,8 +349,9 @@
         mode = _modesetup(ui_, opts)
         if mode:
             colorui._colormode = mode
-            colorui.__bases__ = (ui_.__class__,)
-            ui_.__class__ = colorui
+            if not issubclass(ui_.__class__, colorui):
+                colorui.__bases__ = (ui_.__class__,)
+                ui_.__class__ = colorui
             extstyles()
             configstyles(ui_)
         return orig(ui_, opts, cmd, cmdfunc)