Patchwork [V2] py3: make format strings unicodes and not bytes

login
register
mail settings
Submitter Pulkit Goyal
Date Oct. 8, 2016, 2:39 p.m.
Message ID <6847725111006f427e2c.1475937559@pulkit-goyal>
Download mbox | patch
Permalink /patch/16924/
State Accepted
Headers show

Comments

Pulkit Goyal - Oct. 8, 2016, 2:39 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1475935858 -7200
#      Sat Oct 08 16:10:58 2016 +0200
# Node ID 6847725111006f427e2c460948aa07acb36364a6
# Parent  14da91b1ac26cac422b04a5e41b451e381c75e08
py3: make format strings unicodes and not bytes
Fixes issues on Python 3, wherein docstrings are unicodes.
Shouldn't break anything on Python 2.
Augie Fackler - Oct. 8, 2016, 2:54 p.m.
On Sat, Oct 08, 2016 at 04:39:19PM +0200, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1475935858 -7200
> #      Sat Oct 08 16:10:58 2016 +0200
> # Node ID 6847725111006f427e2c460948aa07acb36364a6
> # Parent  14da91b1ac26cac422b04a5e41b451e381c75e08
> py3: make format strings unicodes and not bytes

Queued, thanks

> Fixes issues on Python 3, wherein docstrings are unicodes.
> Shouldn't break anything on Python 2.
>
> diff -r 14da91b1ac26 -r 684772511100 mercurial/filemerge.py
> --- a/mercurial/filemerge.py	Sat Oct 08 08:36:39 2016 -0400
> +++ b/mercurial/filemerge.py	Sat Oct 08 16:10:58 2016 +0200
> @@ -19,6 +19,7 @@
>      error,
>      formatter,
>      match,
> +    pycompat,
>      scmutil,
>      simplemerge,
>      tagmerge,
> @@ -93,7 +94,8 @@
>      '''return a decorator for populating internal merge tool table'''
>      def decorator(func):
>          fullname = ':' + name
> -        func.__doc__ = "``%s``\n" % fullname + func.__doc__.strip()
> +        func.__doc__ = pycompat.sysstr("``%s``\n" % fullname)
> +                        + func.__doc__.strip()
>          internals[fullname] = func
>          internals['internal:' + name] = func
>          internalsdoc[fullname] = func
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff -r 14da91b1ac26 -r 684772511100 mercurial/filemerge.py
--- a/mercurial/filemerge.py	Sat Oct 08 08:36:39 2016 -0400
+++ b/mercurial/filemerge.py	Sat Oct 08 16:10:58 2016 +0200
@@ -19,6 +19,7 @@ 
     error,
     formatter,
     match,
+    pycompat,
     scmutil,
     simplemerge,
     tagmerge,
@@ -93,7 +94,8 @@ 
     '''return a decorator for populating internal merge tool table'''
     def decorator(func):
         fullname = ':' + name
-        func.__doc__ = "``%s``\n" % fullname + func.__doc__.strip()
+        func.__doc__ = pycompat.sysstr("``%s``\n" % fullname)
+                        + func.__doc__.strip()
         internals[fullname] = func
         internals['internal:' + name] = func
         internalsdoc[fullname] = func