Patchwork [1,of,2,py3] color: replace str() with pycompat.bytestr()

login
register
mail settings
Submitter Pulkit Goyal
Date March 29, 2017, 7:51 p.m.
Message ID <7339bf21508131c90a44.1490817098@pulkit-goyal>
Download mbox | patch
Permalink /patch/19828/
State Accepted
Headers show

Comments

Pulkit Goyal - March 29, 2017, 7:51 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1490779072 -19800
#      Wed Mar 29 14:47:52 2017 +0530
# Node ID 7339bf21508131c90a44317ff16214b81ebe62c1
# Parent  08aeba5bc7c623a700eea9011e0d904e3732134a
color: replace str() with pycompat.bytestr()
Yuya Nishihara - March 30, 2017, 2:20 p.m.
On Thu, 30 Mar 2017 01:21:38 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1490779072 -19800
> #      Wed Mar 29 14:47:52 2017 +0530
> # Node ID 7339bf21508131c90a44317ff16214b81ebe62c1
> # Parent  08aeba5bc7c623a700eea9011e0d904e3732134a
> color: replace str() with pycompat.bytestr()

Queued these, thanks.

> --- a/mercurial/color.py	Sun Mar 26 20:52:51 2017 +0530
> +++ b/mercurial/color.py	Wed Mar 29 14:47:52 2017 +0530
> @@ -332,9 +332,10 @@
>          stop = _effect_str(ui, 'none')
>      else:
>          activeeffects = _activeeffects(ui)
> -        start = [str(activeeffects[e]) for e in ['none'] + effects.split()]
> +        start = [pycompat.bytestr(activeeffects[e]) for e in ['none']
> +                        + effects.split()]
>          start = '\033[' + ';'.join(start) + 'm'
> -        stop = '\033[' + str(activeeffects['none']) + 'm'
> +        stop = '\033[' + pycompat.bytestr(activeeffects['none']) + 'm'

This could be '%d'.

Patch

diff -r 08aeba5bc7c6 -r 7339bf215081 mercurial/color.py
--- a/mercurial/color.py	Sun Mar 26 20:52:51 2017 +0530
+++ b/mercurial/color.py	Wed Mar 29 14:47:52 2017 +0530
@@ -332,9 +332,10 @@ 
         stop = _effect_str(ui, 'none')
     else:
         activeeffects = _activeeffects(ui)
-        start = [str(activeeffects[e]) for e in ['none'] + effects.split()]
+        start = [pycompat.bytestr(activeeffects[e]) for e in ['none']
+                        + effects.split()]
         start = '\033[' + ';'.join(start) + 'm'
-        stop = '\033[' + str(activeeffects['none']) + 'm'
+        stop = '\033[' + pycompat.bytestr(activeeffects['none']) + 'm'
     return _mergeeffects(text, start, stop)
 
 _ansieffectre = re.compile(br'\x1b\[[0-9;]*m')