Patchwork [2,of,3] py3: use pycompat.bytestr() instead of str()

login
register
mail settings
Submitter Pulkit Goyal
Date June 10, 2017, 8:21 a.m.
Message ID <36150d28b8a1d517c531.1497082914@workspace>
Download mbox | patch
Permalink /patch/21307/
State Accepted
Headers show

Comments

Pulkit Goyal - June 10, 2017, 8:21 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1496863306 -19800
#      Thu Jun 08 00:51:46 2017 +0530
# Node ID 36150d28b8a1d517c531542476329b47c18f49c2
# Parent  297af7b6e217a340420566daf960dad2dbe5d0a1
py3: use pycompat.bytestr() instead of str()
Yuya Nishihara - June 11, 2017, 3:37 a.m.
On Sat, 10 Jun 2017 13:51:54 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1496863306 -19800
> #      Thu Jun 08 00:51:46 2017 +0530
> # Node ID 36150d28b8a1d517c531542476329b47c18f49c2
> # Parent  297af7b6e217a340420566daf960dad2dbe5d0a1
> py3: use pycompat.bytestr() instead of str()
> 
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -2883,12 +2883,13 @@
>                    ('+'.join([hexfunc(p.node()) for p in parents]), changed)]
>              if num:
>                  output.append("%s%s" %
> -                  ('+'.join([str(p.rev()) for p in parents]), changed))
> +                  ('+'.join([pycompat.bytestr(p.rev()) for p in parents]),
> +                                                                    changed))

Perhaps '%d' % p.rev() can be used instead.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2883,12 +2883,13 @@ 
                   ('+'.join([hexfunc(p.node()) for p in parents]), changed)]
             if num:
                 output.append("%s%s" %
-                  ('+'.join([str(p.rev()) for p in parents]), changed))
+                  ('+'.join([pycompat.bytestr(p.rev()) for p in parents]),
+                                                                    changed))
         else:
             if default or id:
                 output = [hexfunc(ctx.node())]
             if num:
-                output.append(str(ctx.rev()))
+                output.append(pycompat.bytestr(ctx.rev()))
             taglist = ctx.tags()
 
         if default and not ui.quiet: