Patchwork [3,of,4] py3: alias unicode to str on Python 3

login
register
mail settings
Submitter Pulkit Goyal
Date April 7, 2017, 10:59 a.m.
Message ID <beedb62e62a78a2f45ef.1491562779@pulkit-goyal>
Download mbox | patch
Permalink /patch/19997/
State Accepted
Headers show

Comments

Pulkit Goyal - April 7, 2017, 10:59 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1491560884 -19800
#      Fri Apr 07 15:58:04 2017 +0530
# Node ID beedb62e62a78a2f45ef8bd0b72c51f14619ee7f
# Parent  c08552f3a4ab883aac255bc7d8efb7637ba245d8
py3: alias unicode to str on Python 3
Yuya Nishihara - April 7, 2017, 12:17 p.m.
On Fri, 07 Apr 2017 16:29:39 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1491560884 -19800
> #      Fri Apr 07 15:58:04 2017 +0530
> # Node ID beedb62e62a78a2f45ef8bd0b72c51f14619ee7f
> # Parent  c08552f3a4ab883aac255bc7d8efb7637ba245d8
> py3: alias unicode to str on Python 3
> 
> diff -r c08552f3a4ab -r beedb62e62a7 mercurial/scmutil.py
> --- a/mercurial/scmutil.py	Fri Apr 07 13:46:35 2017 +0530
> +++ b/mercurial/scmutil.py	Fri Apr 07 15:58:04 2017 +0530
> @@ -36,6 +36,9 @@
>  
>  termsize = scmplatform.termsize
>  
> +if pycompat.ispy3:
> +    unicode = str

Let's add pycompat.unicode and/or importer magic. We'll need the unicode
type at several places.

Patch

diff -r c08552f3a4ab -r beedb62e62a7 mercurial/scmutil.py
--- a/mercurial/scmutil.py	Fri Apr 07 13:46:35 2017 +0530
+++ b/mercurial/scmutil.py	Fri Apr 07 15:58:04 2017 +0530
@@ -36,6 +36,9 @@ 
 
 termsize = scmplatform.termsize
 
+if pycompat.ispy3:
+    unicode = str
+
 class status(tuple):
     '''Named tuple with a list of files per status. The 'deleted', 'unknown'
        and 'ignored' properties are only relevant to the working copy.