comparison mercurial/diffhelper.py @ 49284:d44e3c45f0e4

py3: replace `pycompat.xrange` by `range`
author Manuel Jacob <me@manueljacob.de>
date Sun, 29 May 2022 15:17:27 +0200
parents 6000f5b25c9b
children f4733654f144
comparison
equal deleted inserted replaced
49283:44b26349127b 49284:d44e3c45f0e4
8 8
9 from .i18n import _ 9 from .i18n import _
10 10
11 from . import ( 11 from . import (
12 error, 12 error,
13 pycompat,
14 ) 13 )
15 14
16 MISSING_NEWLINE_MARKER = b'\\ No newline at end of file\n' 15 MISSING_NEWLINE_MARKER = b'\\ No newline at end of file\n'
17 16
18 17
27 todoa = lena - len(a) 26 todoa = lena - len(a)
28 todob = lenb - len(b) 27 todob = lenb - len(b)
29 num = max(todoa, todob) 28 num = max(todoa, todob)
30 if num == 0: 29 if num == 0:
31 break 30 break
32 for i in pycompat.xrange(num): 31 for i in range(num):
33 s = fp.readline() 32 s = fp.readline()
34 if not s: 33 if not s:
35 raise error.ParseError(_(b'incomplete hunk')) 34 raise error.ParseError(_(b'incomplete hunk'))
36 if s == MISSING_NEWLINE_MARKER: 35 if s == MISSING_NEWLINE_MARKER:
37 fixnewline(hunk, a, b) 36 fixnewline(hunk, a, b)
74 """ 73 """
75 alen = len(a) 74 alen = len(a)
76 blen = len(b) 75 blen = len(b)
77 if alen > blen - bstart or bstart < 0: 76 if alen > blen - bstart or bstart < 0:
78 return False 77 return False
79 for i in pycompat.xrange(alen): 78 for i in range(alen):
80 if a[i][1:] != b[i + bstart]: 79 if a[i][1:] != b[i + bstart]:
81 return False 80 return False
82 return True 81 return True