# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1497982578 -19800 # Node ID 11c0bb4ccc764c5726deb83086468e423fcccef0 # Parent 30d0cb279bacf791577e90124b2a94018588f0b8 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. diff -r 30d0cb279bac -r 11c0bb4ccc76 mercurial/hg.py --- a/mercurial/hg.py Tue Jun 20 22:11:46 2017 +0530 +++ b/mercurial/hg.py Tue Jun 20 23:46:18 2017 +0530 @@ -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) diff -r 30d0cb279bac -r 11c0bb4ccc76 mercurial/templatekw.py --- a/mercurial/templatekw.py Tue Jun 20 22:11:46 2017 +0530 +++ b/mercurial/templatekw.py Tue Jun 20 23:46:18 2017 +0530 @@ -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: diff -r 30d0cb279bac -r 11c0bb4ccc76 mercurial/templater.py --- a/mercurial/templater.py Tue Jun 20 22:11:46 2017 +0530 +++ b/mercurial/templater.py Tue Jun 20 23:46:18 2017 +0530 @@ -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