color: turn colorui functions into forwards when color is None stable
authorSiddharth Agarwal <sid0@fb.com>
Fri, 19 Apr 2013 16:57:20 -0700
branchstable
changeset 19072 b7b50a54bec9
parent 19071 64ea454e7d76
child 19073 d78d0256198e
color: turn colorui functions into forwards when color is None colorui will be set to None as necessary in an upcoming patch.
hgext/color.py
--- a/hgext/color.py	Fri Apr 19 18:26:35 2013 -0300
+++ b/hgext/color.py	Fri Apr 19 16:57:20 2013 -0700
@@ -317,6 +317,9 @@
 
 class colorui(uimod.ui):
     def popbuffer(self, labeled=False):
+        if self._colormode is None:
+            return super(colorui, self).popbuffer(labeled)
+
         if labeled:
             return ''.join(self.label(a, label) for a, label
                            in self._buffers.pop())
@@ -324,6 +327,9 @@
 
     _colormode = 'ansi'
     def write(self, *args, **opts):
+        if self._colormode is None:
+            return super(colorui, self).write(*args, **opts)
+
         label = opts.get('label', '')
         if self._buffers:
             self._buffers[-1].extend([(str(a), label) for a in args])
@@ -335,6 +341,9 @@
                 *[self.label(str(a), label) for a in args], **opts)
 
     def write_err(self, *args, **opts):
+        if self._colormode is None:
+            return super(colorui, self).write_err(*args, **opts)
+
         label = opts.get('label', '')
         if self._colormode == 'win32':
             for a in args:
@@ -344,6 +353,9 @@
                 *[self.label(str(a), label) for a in args], **opts)
 
     def label(self, msg, label):
+        if self._colormode is None:
+            return super(colorui, self).label(msg, label)
+
         effects = []
         for l in label.split():
             s = _styles.get(l, '')