changeset 21190:2606e7f227f6 stable

color: add missing handling of stderr capture introduced by 350dc24a553d It wouldn't raise exception without this change, but _bufferstates was wrong because of missing _bufferstates.pop() in colorui.popbuffer().
author Yuya Nishihara <yuya@tcha.org>
date Sun, 27 Apr 2014 15:09:48 +0900
parents 2a74c5af892f
children a2f4ea82d6d3
files hgext/color.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Wed Apr 23 20:23:30 2014 +0100
+++ b/hgext/color.py	Sun Apr 27 15:09:48 2014 +0900
@@ -341,6 +341,7 @@
         if self._colormode is None:
             return super(colorui, self).popbuffer(labeled)
 
+        self._bufferstates.pop()
         if labeled:
             return ''.join(self.label(a, label) for a, label
                            in self._buffers.pop())
@@ -366,6 +367,8 @@
             return super(colorui, self).write_err(*args, **opts)
 
         label = opts.get('label', '')
+        if self._bufferstates and self._bufferstates[-1]:
+            return self.write(*args, **opts)
         if self._colormode == 'win32':
             for a in args:
                 win32print(a, super(colorui, self).write_err, **opts)