comparison mercurial/patch.py @ 38085:e887381e2976

py3: bytestr() bytes to get bytechar while iterating on it 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. Differential Revision: https://phab.mercurial-scm.org/D3609
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 19 May 2018 18:51:14 +0530
parents 86e0a4bede5d
children f3776f70985e
comparison
equal deleted inserted replaced
38084:86e0a4bede5d 38085:e887381e2976
1944 """Apply a binary delta hunk 1944 """Apply a binary delta hunk
1945 The algorithm used is the algorithm from git's patch-delta.c 1945 The algorithm used is the algorithm from git's patch-delta.c
1946 """ 1946 """
1947 def deltahead(binchunk): 1947 def deltahead(binchunk):
1948 i = 0 1948 i = 0
1949 for c in binchunk: 1949 for c in pycompat.bytestr(binchunk):
1950 i += 1 1950 i += 1
1951 if not (ord(c) & 0x80): 1951 if not (ord(c) & 0x80):
1952 return i 1952 return i
1953 return i 1953 return i
1954 out = "" 1954 out = ""