D3609: py3: bytestr() bytes to get bytechar while iterating on it
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Sat May 19 14:40:44 UTC 2018
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Iterating on bytes give you ascii values instead of bytechr so we need to wrap
the bytes in pycompat.bytestr() to get bytechr while iterating.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3609
AFFECTED FILES
mercurial/patch.py
mercurial/templater.py
CHANGE DETAILS
diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -253,7 +253,8 @@
p = parser.parser(elements)
try:
while pos < stop:
- n = min((tmpl.find(c, pos, stop) for c in sepchars),
+ n = min((tmpl.find(c, pos, stop)
+ for c in pycompat.bytestr(sepchars)),
key=lambda n: (n < 0, n))
if n < 0:
yield ('string', unescape(tmpl[pos:stop]), pos)
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1946,7 +1946,7 @@
"""
def deltahead(binchunk):
i = 0
- for c in binchunk:
+ for c in pycompat.bytestr(binchunk):
i += 1
if not (ord(c) & 0x80):
return i
To: pulkit, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list