changeset 33753:11c0bb4ccc76

py3: replace str with bytes in isinstance() We were using str because on Python 2, str were bytes but now we have to use bytes. Otherwise the if conditions fails and we have weird results from commands on Python 3.
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 20 Jun 2017 23:46:18 +0530
parents 30d0cb279bac
children accfa165736b
files mercurial/hg.py mercurial/templatekw.py mercurial/templater.py
diffstat 3 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -477,7 +477,7 @@
     remote's path/URL. Defaults to "identity."
     """
 
-    if isinstance(source, str):
+    if isinstance(source, bytes):
         origsource = ui.expandpath(source)
         source, branch = parseurl(origsource, branch)
         srcpeer = peer(ui, peeropts, source)
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -126,7 +126,7 @@
             yield templ(noname, **mapping)
         return
     if name not in templ:
-        if isinstance(values[0], str):
+        if isinstance(values[0], bytes):
             yield separator.join(values)
         else:
             for v in values:
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -1101,7 +1101,7 @@
 def _flatten(thing):
     '''yield a single stream from a possibly nested set of iterators'''
     thing = templatekw.unwraphybrid(thing)
-    if isinstance(thing, str):
+    if isinstance(thing, bytes):
         yield thing
     elif thing is None:
         pass
@@ -1110,7 +1110,7 @@
     else:
         for i in thing:
             i = templatekw.unwraphybrid(i)
-            if isinstance(i, str):
+            if isinstance(i, bytes):
                 yield i
             elif i is None:
                 pass