Patchwork color: drop useless override of ui.popbuffer()

login
register
mail settings
Submitter Yuya Nishihara
Date Dec. 6, 2015, 3:23 p.m.
Message ID <95adb7bad8aa2d7bee69.1449415439@mimosa>
Download mbox | patch
Permalink /patch/11858/
State Accepted
Headers show

Comments

Yuya Nishihara - Dec. 6, 2015, 3:23 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1449326471 -32400
#      Sat Dec 05 23:41:11 2015 +0900
# Node ID 95adb7bad8aa2d7bee699aeaacf0372ed23041b5
# Parent  094073353710dad068f30a8e4d1d2524e5dc34ca
color: drop useless override of ui.popbuffer()

Because labels are applied at write() time since 717b75ae5bb0,
colorui.popbuffer() is useless and it doesn't update _bufferapplylabels
correctly. Removing it should fix the problem.
Gregory Szorc - Dec. 6, 2015, 5:11 p.m.
On Sun, Dec 6, 2015 at 7:23 AM, Yuya Nishihara <yuya@tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1449326471 -32400
> #      Sat Dec 05 23:41:11 2015 +0900
> # Node ID 95adb7bad8aa2d7bee699aeaacf0372ed23041b5
> # Parent  094073353710dad068f30a8e4d1d2524e5dc34ca
> color: drop useless override of ui.popbuffer()
>
> Because labels are applied at write() time since 717b75ae5bb0,
> colorui.popbuffer() is useless and it doesn't update _bufferapplylabels
> correctly. Removing it should fix the problem.
>
> diff --git a/hgext/color.py b/hgext/color.py
> --- a/hgext/color.py
> +++ b/hgext/color.py
> @@ -419,13 +419,6 @@ def configstyles(ui):
>              _styles[status] = ' '.join(good)
>
>  class colorui(uimod.ui):
> -    def popbuffer(self):
> -        if self._colormode is None:
> -            return super(colorui, self).popbuffer()
> -
> -        self._bufferstates.pop()
> -        return ''.join(self._buffers.pop())
> -
>      _colormode = 'ansi'
>      def write(self, *args, **opts):
>          if self._colormode is None:
>
>
LGTM. I'd queue it if I had the powers.

Patch

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -419,13 +419,6 @@  def configstyles(ui):
             _styles[status] = ' '.join(good)
 
 class colorui(uimod.ui):
-    def popbuffer(self):
-        if self._colormode is None:
-            return super(colorui, self).popbuffer()
-
-        self._bufferstates.pop()
-        return ''.join(self._buffers.pop())
-
     _colormode = 'ansi'
     def write(self, *args, **opts):
         if self._colormode is None: