Patchwork D3609: py3: bytestr() bytes to get bytechar while iterating on it

login
register
mail settings
Submitter phabricator
Date May 19, 2018, 7:40 p.m.
Message ID <2cd3a0fb363e745deb1c4c15e9631d00@localhost.localdomain>
Download mbox | patch
Permalink /patch/31734/
State Not Applicable
Headers show

Comments

phabricator - May 19, 2018, 7:40 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe887381e2976: py3: bytestr() bytes to get bytechar while iterating on it (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3609?vs=8780&id=8815

REVISION DETAIL
  https://phab.mercurial-scm.org/D3609

AFFECTED FILES
  mercurial/patch.py
  mercurial/templater.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

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