Patchwork [STABLE] color: add missing handling of stderr capture introduced by 350dc24a553d

login
register
mail settings
Submitter Yuya Nishihara
Date April 27, 2014, 7:59 a.m.
Message ID <faf1ce941b0cc2e69992.1398585566@gimlet>
Download mbox | patch
Permalink /patch/4442/
State Accepted
Headers show

Comments

Yuya Nishihara - April 27, 2014, 7:59 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1398578988 -32400
#      Sun Apr 27 15:09:48 2014 +0900
# Branch stable
# Node ID faf1ce941b0cc2e699929d33ac494b5e934146c4
# Parent  d36440d843284ba546858b241da9cc4817811fe5
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().
Matt Mackall - April 28, 2014, 9:25 p.m.
On Sun, 2014-04-27 at 16:59 +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1398578988 -32400
> #      Sun Apr 27 15:09:48 2014 +0900
> # Branch stable
> # Node ID faf1ce941b0cc2e699929d33ac494b5e934146c4
> # Parent  d36440d843284ba546858b241da9cc4817811fe5
> color: add missing handling of stderr capture introduced by 350dc24a553d

Queued for stable, thanks.

Patch

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -341,6 +341,7 @@  class colorui(uimod.ui):
         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 @@  class colorui(uimod.ui):
             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)