diff mercurial/mdiff.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 642e31cb55f0
children a78dfb1ad60e
line wrap: on
line diff
--- a/mercurial/mdiff.py	Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/mdiff.py	Sun May 29 15:17:27 2022 +0200
@@ -378,7 +378,7 @@
             # walk backwards from the start of the context up to the start of
             # the previous hunk context until we find a line starting with an
             # alphanumeric char.
-            for i in pycompat.xrange(astart - 1, lastpos - 1, -1):
+            for i in range(astart - 1, lastpos - 1, -1):
                 if l1[i][0:1].isalnum():
                     func = b' ' + l1[i].rstrip()
                     # split long function name if ASCII. otherwise we have no
@@ -402,7 +402,7 @@
         hunklines = (
             [b"@@ -%d,%d +%d,%d @@%s\n" % (hunkrange + (func,))]
             + delta
-            + [b' ' + l1[x] for x in pycompat.xrange(a2, aend)]
+            + [b' ' + l1[x] for x in range(a2, aend)]
         )
         # If either file ends without a newline and the last line of
         # that file is part of a hunk, a marker is printed. If the
@@ -411,7 +411,7 @@
         # which the hunk can end in a shared line without a newline.
         skip = False
         if not t1.endswith(b'\n') and astart + alen == len(l1) + 1:
-            for i in pycompat.xrange(len(hunklines) - 1, -1, -1):
+            for i in range(len(hunklines) - 1, -1, -1):
                 if hunklines[i].startswith((b'-', b' ')):
                     if hunklines[i].startswith(b' '):
                         skip = True
@@ -419,7 +419,7 @@
                     hunklines.insert(i + 1, diffhelper.MISSING_NEWLINE_MARKER)
                     break
         if not skip and not t2.endswith(b'\n') and bstart + blen == len(l2) + 1:
-            for i in pycompat.xrange(len(hunklines) - 1, -1, -1):
+            for i in range(len(hunklines) - 1, -1, -1):
                 if hunklines[i].startswith(b'+'):
                     hunklines[i] += b'\n'
                     hunklines.insert(i + 1, diffhelper.MISSING_NEWLINE_MARKER)