diff mercurial/pure/mpatch.py @ 43077:687b865b95ad

formatting: byteify all mercurial/ and hgext/ string literals Done with python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py') black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**') # skip-blame mass-reformatting only Differential Revision: https://phab.mercurial-scm.org/D6972
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:48:39 -0400
parents 2372284d9457
children 89a2afe31e82
line wrap: on
line diff
--- a/mercurial/pure/mpatch.py	Sun Oct 06 09:45:02 2019 -0400
+++ b/mercurial/pure/mpatch.py	Sun Oct 06 09:48:39 2019 -0400
@@ -97,9 +97,9 @@
         while pos < end:
             m.seek(pos)
             try:
-                p1, p2, l = struct.unpack(">lll", m.read(12))
+                p1, p2, l = struct.unpack(b">lll", m.read(12))
             except struct.error:
-                raise mpatchError("patch cannot be decoded")
+                raise mpatchError(b"patch cannot be decoded")
             _pull(new, frags, p1 - last)  # what didn't change
             _pull([], frags, p2 - p1)  # what got deleted
             new.append((l, pos + 12))  # what got added
@@ -120,7 +120,7 @@
 
     while data <= binend:
         decode = delta[bin : bin + 12]
-        start, end, length = struct.unpack(">lll", decode)
+        start, end, length = struct.unpack(b">lll", decode)
         if start > end:
             break
         bin = data + length
@@ -130,7 +130,7 @@
         outlen += length
 
     if bin != binend:
-        raise mpatchError("patch cannot be decoded")
+        raise mpatchError(b"patch cannot be decoded")
 
     outlen += orig - last
     return outlen