--- a/hgext/absorb.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/absorb.py Sun May 29 15:17:27 2022 +0200
@@ -424,7 +424,7 @@
newfixups.append((fixuprev, a1, a2, b1, b2))
elif a2 - a1 == b2 - b1 or b1 == b2:
# 1:1 line mapping, or chunk was deleted
- for i in pycompat.xrange(a1, a2):
+ for i in range(a1, a2):
rev, linenum = annotated[i]
if rev > 1:
if b1 == b2: # deletion, simply remove that single line
@@ -451,7 +451,7 @@
"""
llog = linelog.linelog()
a, alines = b'', []
- for i in pycompat.xrange(len(self.contents)):
+ for i in range(len(self.contents)):
b, blines = self.contents[i], self.contentlines[i]
llrev = i * 2 + 1
chunks = self._alldiffchunks(a, b, alines, blines)
@@ -463,7 +463,7 @@
def _checkoutlinelog(self):
"""() -> [str]. check out file contents from linelog"""
contents = []
- for i in pycompat.xrange(len(self.contents)):
+ for i in range(len(self.contents)):
rev = (i + 1) * 2
self.linelog.annotate(rev)
content = b''.join(map(self._getline, self.linelog.annotateresult))
@@ -605,9 +605,9 @@
a1, a2, b1, b2 = chunk
aidxs, bidxs = [0] * (a2 - a1), [0] * (b2 - b1)
for idx, fa1, fa2, fb1, fb2 in fixups:
- for i in pycompat.xrange(fa1, fa2):
+ for i in range(fa1, fa2):
aidxs[i - a1] = (max(idx, 1) - 1) // 2
- for i in pycompat.xrange(fb1, fb2):
+ for i in range(fb1, fb2):
bidxs[i - b1] = (max(idx, 1) - 1) // 2
fm.startitem()
@@ -637,7 +637,7 @@
)
fm.data(path=self.path, linetype=linetype)
- for i in pycompat.xrange(a1, a2):
+ for i in range(a1, a2):
writeline(
aidxs[i - a1],
b'-',
@@ -645,7 +645,7 @@
b'deleted',
b'diff.deleted',
)
- for i in pycompat.xrange(b1, b2):
+ for i in range(b1, b2):
writeline(
bidxs[i - b1],
b'+',
--- a/hgext/acl.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/acl.py Sun May 29 15:17:27 2022 +0200
@@ -219,7 +219,6 @@
error,
extensions,
match,
- pycompat,
registrar,
util,
)
@@ -452,7 +451,7 @@
allow = buildmatch(ui, repo, user, b'acl.allow')
deny = buildmatch(ui, repo, user, b'acl.deny')
- for rev in pycompat.xrange(repo[node].rev(), len(repo)):
+ for rev in range(repo[node].rev(), len(repo)):
ctx = repo[rev]
branch = ctx.branch()
if denybranches and denybranches(branch):
--- a/hgext/beautifygraph.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/beautifygraph.py Sun May 29 15:17:27 2022 +0200
@@ -17,7 +17,6 @@
encoding,
extensions,
graphmod,
- pycompat,
templatekw,
)
@@ -53,7 +52,7 @@
def convertedges(line):
line = b' %s ' % line
pretty = []
- for idx in pycompat.xrange(len(line) - 2):
+ for idx in range(len(line) - 2):
pretty.append(
prettyedge(
line[idx : idx + 1],
--- a/hgext/convert/cvsps.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/convert/cvsps.py Sun May 29 15:17:27 2022 +0200
@@ -832,7 +832,7 @@
# branchpoints such that it is the latest possible
# commit without any intervening, unrelated commits.
- for candidate in pycompat.xrange(i):
+ for candidate in range(i):
if c.branch not in changesets[candidate].branchpoints:
if p is not None:
break
--- a/hgext/eol.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/eol.py Sun May 29 15:17:27 2022 +0200
@@ -309,7 +309,7 @@
ensureenabled(ui)
files = set()
revs = set()
- for rev in pycompat.xrange(repo[node].rev(), len(repo)):
+ for rev in range(repo[node].rev(), len(repo)):
revs.add(rev)
if headsonly:
ctx = repo[rev]
--- a/hgext/fastannotate/context.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/fastannotate/context.py Sun May 29 15:17:27 2022 +0200
@@ -75,7 +75,7 @@
linecount = text.count(b'\n')
if text and not text.endswith(b'\n'):
linecount += 1
- return ([(fctx, i) for i in pycompat.xrange(linecount)], text)
+ return ([(fctx, i) for i in range(linecount)], text)
# extracted from mercurial.context.basefilectx.annotate. slightly modified
@@ -577,7 +577,7 @@
result = [None] * len(annotateresult)
# {(rev, linenum): [lineindex]}
key2idxs = collections.defaultdict(list)
- for i in pycompat.xrange(len(result)):
+ for i in range(len(result)):
key2idxs[(revs[i], annotateresult[i][1])].append(i)
while key2idxs:
# find an unresolved line and its linelog rev to annotate
--- a/hgext/fastannotate/formatter.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/fastannotate/formatter.py Sun May 29 15:17:27 2022 +0200
@@ -93,7 +93,7 @@
# buffered output
result = b''
- for i in pycompat.xrange(len(annotatedresult)):
+ for i in range(len(annotatedresult)):
for j, p in enumerate(pieces):
sep = self.funcmap[j][1]
padding = b' ' * (maxwidths[j] - len(p[i]))
@@ -148,7 +148,7 @@
result = b''
lasti = len(annotatedresult) - 1
- for i in pycompat.xrange(len(annotatedresult)):
+ for i in range(len(annotatedresult)):
result += b'\n {\n'
for j, p in enumerate(pieces):
k, vs = p
--- a/hgext/fastannotate/revmap.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/fastannotate/revmap.py Sun May 29 15:17:27 2022 +0200
@@ -15,7 +15,6 @@
from mercurial.pycompat import open
from mercurial import (
error as hgerror,
- pycompat,
)
from . import error
@@ -165,13 +164,11 @@
if self._lastmaxrev == -1: # write the entire file
with open(self.path, b'wb') as f:
f.write(self.HEADER)
- for i in pycompat.xrange(1, len(self._rev2hsh)):
+ for i in range(1, len(self._rev2hsh)):
self._writerev(i, f)
else: # append incrementally
with open(self.path, b'ab') as f:
- for i in pycompat.xrange(
- self._lastmaxrev + 1, len(self._rev2hsh)
- ):
+ for i in range(self._lastmaxrev + 1, len(self._rev2hsh)):
self._writerev(i, f)
self._lastmaxrev = self.maxrev
--- a/hgext/git/gitlog.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/git/gitlog.py Sun May 29 15:17:27 2022 +0200
@@ -112,7 +112,7 @@
return False
def __iter__(self):
- return iter(pycompat.xrange(len(self)))
+ return iter(range(len(self)))
@property
def filteredrevs(self):
@@ -186,7 +186,7 @@
def shortest(self, node, minlength=1):
nodehex = hex(node)
- for attempt in pycompat.xrange(minlength, len(nodehex) + 1):
+ for attempt in range(minlength, len(nodehex) + 1):
candidate = nodehex[:attempt]
matches = int(
self._db.execute(
--- a/hgext/hgk.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/hgk.py Sun May 29 15:17:27 2022 +0200
@@ -245,7 +245,7 @@
else:
i -= chunk
- for x in pycompat.xrange(chunk):
+ for x in range(chunk):
if i + x >= count:
l[chunk - x :] = [0] * (chunk - x)
break
@@ -256,7 +256,7 @@
else:
if (i + x) in repo:
l[x] = 1
- for x in pycompat.xrange(chunk - 1, -1, -1):
+ for x in range(chunk - 1, -1, -1):
if l[x] != 0:
yield (i + x, full is not None and l[x] or None)
if i == 0:
@@ -267,7 +267,7 @@
if len(ar) == 0:
return 1
mask = 0
- for i in pycompat.xrange(len(ar)):
+ for i in range(len(ar)):
if sha in reachable[i]:
mask |= 1 << i
--- a/hgext/histedit.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/histedit.py Sun May 29 15:17:27 2022 +0200
@@ -455,7 +455,7 @@
rules = []
rulelen = int(lines[index])
index += 1
- for i in pycompat.xrange(rulelen):
+ for i in range(rulelen):
ruleaction = lines[index]
index += 1
rule = lines[index]
@@ -466,7 +466,7 @@
replacements = []
replacementlen = int(lines[index])
index += 1
- for i in pycompat.xrange(replacementlen):
+ for i in range(replacementlen):
replacement = lines[index]
original = bin(replacement[:40])
succ = [
@@ -1574,7 +1574,7 @@
start = min(old_rule_pos, new_rule_pos)
end = max(old_rule_pos, new_rule_pos)
- for r in pycompat.xrange(start, end + 1):
+ for r in range(start, end + 1):
rules[new_rule_pos].checkconflicts(rules[r])
rules[old_rule_pos].checkconflicts(rules[r])
--- a/hgext/mq.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/mq.py Sun May 29 15:17:27 2022 +0200
@@ -461,7 +461,7 @@
the field and a blank line."""
if self.message:
subj = b'subject: ' + self.message[0].lower()
- for i in pycompat.xrange(len(self.comments)):
+ for i in range(len(self.comments)):
if subj == self.comments[i].lower():
del self.comments[i]
self.message = self.message[2:]
@@ -2040,7 +2040,7 @@
# if the patch excludes a modified file, mark that
# file with mtime=0 so status can see it.
mm = []
- for i in pycompat.xrange(len(m) - 1, -1, -1):
+ for i in range(len(m) - 1, -1, -1):
if not match1(m[i]):
mm.append(m[i])
del m[i]
@@ -2165,7 +2165,7 @@
else:
start = self.series.index(patch) + 1
unapplied = []
- for i in pycompat.xrange(start, len(self.series)):
+ for i in range(start, len(self.series)):
pushable, reason = self.pushable(i)
if pushable:
unapplied.append((i, self.series[i]))
@@ -2210,7 +2210,7 @@
if not missing:
if self.ui.verbose:
idxwidth = len(b"%d" % (start + length - 1))
- for i in pycompat.xrange(start, start + length):
+ for i in range(start, start + length):
patch = self.series[i]
if patch in applied:
char, state = b'A', b'applied'
@@ -2371,7 +2371,7 @@
def nextpatch(start):
if all_patches or start >= len(self.series):
return start
- for i in pycompat.xrange(start, len(self.series)):
+ for i in range(start, len(self.series)):
p, reason = self.pushable(i)
if p:
return i
@@ -3389,7 +3389,7 @@
raise error.Abort(
_(b'cannot mix -l/--list with options or arguments')
)
- for i in pycompat.xrange(len(q.series)):
+ for i in range(len(q.series)):
status(i)
return
if not args or args[0][0:1] in b'-+':
@@ -3767,18 +3767,14 @@
pushable = lambda i: q.pushable(q.applied[i].name)[0]
if args or opts.get(b'none'):
old_unapplied = q.unapplied(repo)
- old_guarded = [
- i for i in pycompat.xrange(len(q.applied)) if not pushable(i)
- ]
+ old_guarded = [i for i in range(len(q.applied)) if not pushable(i)]
q.setactive(args)
q.savedirty()
if not args:
ui.status(_(b'guards deactivated\n'))
if not opts.get(b'pop') and not opts.get(b'reapply'):
unapplied = q.unapplied(repo)
- guarded = [
- i for i in pycompat.xrange(len(q.applied)) if not pushable(i)
- ]
+ guarded = [i for i in range(len(q.applied)) if not pushable(i)]
if len(unapplied) != len(old_unapplied):
ui.status(
_(
@@ -3825,7 +3821,7 @@
reapply = opts.get(b'reapply') and q.applied and q.applied[-1].name
popped = False
if opts.get(b'pop') or opts.get(b'reapply'):
- for i in pycompat.xrange(len(q.applied)):
+ for i in range(len(q.applied)):
if not pushable(i):
ui.status(_(b'popping guarded patches\n'))
popped = True
--- a/hgext/remotefilelog/basepack.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/remotefilelog/basepack.py Sun May 29 15:17:27 2022 +0200
@@ -318,7 +318,7 @@
params = self.params
rawfanout = self._index[FANOUTSTART : FANOUTSTART + params.fanoutsize]
fanouttable = []
- for i in pycompat.xrange(0, params.fanoutcount):
+ for i in range(0, params.fanoutcount):
loc = i * 4
fanoutentry = struct.unpack(b'!I', rawfanout[loc : loc + 4])[0]
fanouttable.append(fanoutentry)
--- a/hgext/remotefilelog/basestore.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/remotefilelog/basestore.py Sun May 29 15:17:27 2022 +0200
@@ -171,7 +171,7 @@
# Scan the changelog until we've found every file name
cl = self.repo.unfiltered().changelog
- for rev in pycompat.xrange(len(cl) - 1, -1, -1):
+ for rev in range(len(cl) - 1, -1, -1):
if not missingfilename:
break
files = cl.readfiles(cl.node(rev))
--- a/hgext/remotefilelog/contentstore.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/remotefilelog/contentstore.py Sun May 29 15:17:27 2022 +0200
@@ -7,7 +7,6 @@
from mercurial.pycompat import getattr
from mercurial import (
mdiff,
- pycompat,
revlog,
)
from . import (
@@ -366,7 +365,7 @@
rl = revlog.revlog(self._svfs, radix=b'00manifesttree')
startlinkrev = self._repackstartlinkrev
endlinkrev = self._repackendlinkrev
- for rev in pycompat.xrange(len(rl) - 1, -1, -1):
+ for rev in range(len(rl) - 1, -1, -1):
linkrev = rl.linkrev(rev)
if linkrev < startlinkrev:
break
@@ -383,7 +382,7 @@
treename = path[5 : -len(b'/00manifest')]
rl = revlog.revlog(self._svfs, indexfile=path[:-2])
- for rev in pycompat.xrange(len(rl) - 1, -1, -1):
+ for rev in range(len(rl) - 1, -1, -1):
linkrev = rl.linkrev(rev)
if linkrev < startlinkrev:
break
--- a/hgext/remotefilelog/datapack.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/remotefilelog/datapack.py Sun May 29 15:17:27 2022 +0200
@@ -7,7 +7,6 @@
)
from mercurial.i18n import _
from mercurial import (
- pycompat,
util,
)
from . import (
@@ -232,7 +231,7 @@
# Scan forward to find the first non-same entry, which is the upper
# bound.
- for i in pycompat.xrange(fanoutkey + 1, params.fanoutcount):
+ for i in range(fanoutkey + 1, params.fanoutcount):
end = fanout[i] + params.indexstart
if end != start:
break
--- a/hgext/remotefilelog/historypack.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/remotefilelog/historypack.py Sun May 29 15:17:27 2022 +0200
@@ -5,7 +5,6 @@
sha1nodeconstants,
)
from mercurial import (
- pycompat,
util,
)
from mercurial.utils import hashutil
@@ -207,7 +206,7 @@
start = fanout[fanoutkey] + params.indexstart
indexend = self._indexend
- for i in pycompat.xrange(fanoutkey + 1, params.fanoutcount):
+ for i in range(fanoutkey + 1, params.fanoutcount):
end = fanout[i] + params.indexstart
if end != start:
break
@@ -323,7 +322,7 @@
)[0]
offset += ENTRYCOUNTSIZE
- for i in pycompat.xrange(revcount):
+ for i in range(revcount):
entry = struct.unpack(
PACKFORMAT, data[offset : offset + PACKENTRYLENGTH]
)
--- a/hgext/remotefilelog/repack.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/remotefilelog/repack.py Sun May 29 15:17:27 2022 +0200
@@ -9,7 +9,6 @@
lock as lockmod,
mdiff,
policy,
- pycompat,
scmutil,
util,
vfs,
@@ -347,7 +346,7 @@
# Group the packs by generation (i.e. by size)
generations = []
- for i in pycompat.xrange(len(limits)):
+ for i in range(len(limits)):
generations.append([])
sizes = {}
--- a/hgext/remotefilelog/shallowbundle.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/remotefilelog/shallowbundle.py Sun May 29 15:17:27 2022 +0200
@@ -13,7 +13,6 @@
error,
match,
mdiff,
- pycompat,
)
from . import (
constants,
@@ -43,7 +42,7 @@
nodelist.insert(0, p)
# build deltas
- for i in pycompat.xrange(len(nodelist) - 1):
+ for i in range(len(nodelist) - 1):
prev, curr = nodelist[i], nodelist[i + 1]
linknode = lookup(curr)
for c in self.nodechunk(rlog, curr, prev, linknode):
--- a/hgext/remotefilelog/shallowutil.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/remotefilelog/shallowutil.py Sun May 29 15:17:27 2022 +0200
@@ -454,14 +454,14 @@
def readnodelist(stream):
rawlen = readexactly(stream, constants.NODECOUNTSIZE)
nodecount = struct.unpack(constants.NODECOUNTSTRUCT, rawlen)[0]
- for i in pycompat.xrange(nodecount):
+ for i in range(nodecount):
yield readexactly(stream, constants.NODESIZE)
def readpathlist(stream):
rawlen = readexactly(stream, constants.PATHCOUNTSIZE)
pathcount = struct.unpack(constants.PATHCOUNTSTRUCT, rawlen)[0]
- for i in pycompat.xrange(pathcount):
+ for i in range(pathcount):
yield readpath(stream)
--- a/hgext/sqlitestore.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/sqlitestore.py Sun May 29 15:17:27 2022 +0200
@@ -396,7 +396,7 @@
return len(self._revisions)
def __iter__(self):
- return iter(pycompat.xrange(len(self._revisions)))
+ return iter(range(len(self._revisions)))
def hasnode(self, node):
if node == sha1nodeconstants.nullid:
--- a/hgext/win32text.py Sun May 29 12:38:54 2022 +0200
+++ b/hgext/win32text.py Sun May 29 15:17:27 2022 +0200
@@ -48,7 +48,6 @@
from mercurial import (
cmdutil,
extensions,
- pycompat,
registrar,
)
from mercurial.utils import stringutil
@@ -156,9 +155,7 @@
# changegroup that contains an unacceptable commit followed later
# by a commit that fixes the problem.
tip = repo[b'tip']
- for rev in pycompat.xrange(
- repo.changelog.tiprev(), repo[node].rev() - 1, -1
- ):
+ for rev in range(repo.changelog.tiprev(), repo[node].rev() - 1, -1):
c = repo[rev]
for f in c.files():
if f in seen or f not in tip or f not in c:
--- a/mercurial/ancestor.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/ancestor.py Sun May 29 15:17:27 2022 +0200
@@ -12,7 +12,6 @@
from . import (
dagop,
policy,
- pycompat,
)
parsers = policy.importmod('parsers')
@@ -187,7 +186,7 @@
# no revs to consider
return
- for curr in pycompat.xrange(start, min(revs) - 1, -1):
+ for curr in range(start, min(revs) - 1, -1):
if curr not in bases:
continue
revs.discard(curr)
@@ -228,7 +227,7 @@
# exit.
missing = []
- for curr in pycompat.xrange(start, nullrev, -1):
+ for curr in range(start, nullrev, -1):
if not revsvisit:
break
--- a/mercurial/changegroup.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/changegroup.py Sun May 29 15:17:27 2022 +0200
@@ -420,7 +420,7 @@
cl = repo.changelog
ml = repo.manifestlog
# validate incoming csets have their manifests
- for cset in pycompat.xrange(clstart, clend):
+ for cset in range(clstart, clend):
mfnode = cl.changelogrevision(cset).manifest
mfest = ml[mfnode].readdelta()
# store file nodes we must see
@@ -509,7 +509,7 @@
**pycompat.strkwargs(hookargs)
)
- added = pycompat.xrange(clstart, clend)
+ added = range(clstart, clend)
phaseall = None
if srctype in (b'push', b'serve'):
# Old servers can not push the boundary themselves.
@@ -825,7 +825,7 @@
# somewhat unsurprised to find a case in the wild
# where this breaks down a bit. That said, I don't
# know if it would hurt anything.
- for i in pycompat.xrange(rev, 0, -1):
+ for i in range(rev, 0, -1):
if store.linkrev(i) == clrev:
return i
# We failed to resolve a parent for this node, so
@@ -1956,7 +1956,7 @@
revisions += len(fl) - o
if f in needfiles:
needs = needfiles[f]
- for new in pycompat.xrange(o, len(fl)):
+ for new in range(o, len(fl)):
n = fl.node(new)
if n in needs:
needs.remove(n)
--- a/mercurial/context.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/context.py Sun May 29 15:17:27 2022 +0200
@@ -32,7 +32,6 @@
patch,
pathutil,
phases,
- pycompat,
repoview,
scmutil,
sparse,
@@ -2431,7 +2430,7 @@
# Test that each new directory to be created to write this path from p2
# is not a file in p1.
components = path.split(b'/')
- for i in pycompat.xrange(len(components)):
+ for i in range(len(components)):
component = b"/".join(components[0:i])
if component in self:
fail(path, component)
--- a/mercurial/dagop.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/dagop.py Sun May 29 15:17:27 2022 +0200
@@ -203,7 +203,7 @@
def _builddescendantsmap(repo, startrev, followfirst):
"""Build map of 'rev -> child revs', offset from startrev"""
cl = repo.changelog
- descmap = [[] for _rev in pycompat.xrange(startrev, len(cl))]
+ descmap = [[] for _rev in range(startrev, len(cl))]
for currev in cl.revs(startrev + 1):
p1rev, p2rev = cl.parentrevs(currev)
if p1rev >= startrev:
@@ -725,7 +725,7 @@
for idx, (parent, blocks) in enumerate(pblocks):
for (a1, a2, b1, b2), _t in blocks:
if a2 - a1 >= b2 - b1:
- for bk in pycompat.xrange(b1, b2):
+ for bk in range(b1, b2):
if child.fctxs[bk] == childfctx:
ak = min(a1 + (bk - b1), a2 - 1)
child.fctxs[bk] = parent.fctxs[ak]
@@ -738,7 +738,7 @@
# line.
for parent, blocks in remaining:
for a1, a2, b1, b2 in blocks:
- for bk in pycompat.xrange(b1, b2):
+ for bk in range(b1, b2):
if child.fctxs[bk] == childfctx:
ak = min(a1 + (bk - b1), a2 - 1)
child.fctxs[bk] = parent.fctxs[ak]
--- a/mercurial/dagparser.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/dagparser.py Sun May 29 15:17:27 2022 +0200
@@ -228,7 +228,7 @@
c, digs = nextrun(nextch(), pycompat.bytestr(string.digits))
# pytype: enable=wrong-arg-types
n = int(digs)
- for i in pycompat.xrange(0, n):
+ for i in range(0, n):
yield b'n', (r, [p1])
p1 = r
r += 1
--- a/mercurial/debugcommands.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/debugcommands.py Sun May 29 15:17:27 2022 +0200
@@ -248,9 +248,7 @@
if mergeable_file:
linesperrev = 2
# make a file with k lines per rev
- initialmergedlines = [
- b'%d' % i for i in pycompat.xrange(0, total * linesperrev)
- ]
+ initialmergedlines = [b'%d' % i for i in range(0, total * linesperrev)]
initialmergedlines.append(b"")
tags = []
@@ -3193,7 +3191,7 @@
ts = 0
heads = set()
- for rev in pycompat.xrange(numrevs):
+ for rev in range(numrevs):
dbase = r.deltaparent(rev)
if dbase == -1:
dbase = rev
@@ -3291,7 +3289,7 @@
l[2] += size
numrevs = len(r)
- for rev in pycompat.xrange(numrevs):
+ for rev in range(numrevs):
p1, p2 = r.parentrevs(rev)
delta = r.deltaparent(rev)
if format > 0:
--- a/mercurial/diffhelper.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/diffhelper.py Sun May 29 15:17:27 2022 +0200
@@ -10,7 +10,6 @@
from . import (
error,
- pycompat,
)
MISSING_NEWLINE_MARKER = b'\\ No newline at end of file\n'
@@ -29,7 +28,7 @@
num = max(todoa, todob)
if num == 0:
break
- for i in pycompat.xrange(num):
+ for i in range(num):
s = fp.readline()
if not s:
raise error.ParseError(_(b'incomplete hunk'))
@@ -76,7 +75,7 @@
blen = len(b)
if alen > blen - bstart or bstart < 0:
return False
- for i in pycompat.xrange(alen):
+ for i in range(alen):
if a[i][1:] != b[i + bstart]:
return False
return True
--- a/mercurial/encoding.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/encoding.py Sun May 29 15:17:27 2022 +0200
@@ -401,7 +401,7 @@
# type: (bytes, int, int) -> bytes
"""Use colwidth to find a c-column substring of s starting at byte
index start"""
- for x in pycompat.xrange(start + c, len(s)):
+ for x in range(start + c, len(s)):
t = s[start:x]
if colwidth(t) == c:
return t
--- a/mercurial/graphmod.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/graphmod.py Sun May 29 15:17:27 2022 +0200
@@ -22,7 +22,6 @@
from .thirdparty import attr
from . import (
dagop,
- pycompat,
smartset,
util,
)
@@ -463,16 +462,16 @@
# shift_interline is the line containing the non-vertical
# edges between this entry and the next
shift_interline = echars[: idx * 2]
- for i in pycompat.xrange(2 + coldiff):
+ for i in range(2 + coldiff):
shift_interline.append(b' ')
count = ncols - idx - 1
if coldiff == -1:
- for i in pycompat.xrange(count):
+ for i in range(count):
shift_interline.extend([b'/', b' '])
elif coldiff == 0:
shift_interline.extend(echars[(idx + 1) * 2 : ncols * 2])
else:
- for i in pycompat.xrange(count):
+ for i in range(count):
shift_interline.extend([b'\\', b' '])
# draw edges from the current node to its parents
--- a/mercurial/grep.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/grep.py Sun May 29 15:17:27 2022 +0200
@@ -67,15 +67,15 @@
sm = difflib.SequenceMatcher(None, a, b)
for tag, alo, ahi, blo, bhi in sm.get_opcodes():
if tag == 'insert':
- for i in pycompat.xrange(blo, bhi):
+ for i in range(blo, bhi):
yield (b'+', b[i])
elif tag == 'delete':
- for i in pycompat.xrange(alo, ahi):
+ for i in range(alo, ahi):
yield (b'-', a[i])
elif tag == 'replace':
- for i in pycompat.xrange(alo, ahi):
+ for i in range(alo, ahi):
yield (b'-', a[i])
- for i in pycompat.xrange(blo, bhi):
+ for i in range(blo, bhi):
yield (b'+', b[i])
--- a/mercurial/hgweb/webcommands.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/hgweb/webcommands.py Sun May 29 15:17:27 2022 +0200
@@ -228,7 +228,7 @@
def revgen():
cl = web.repo.changelog
- for i in pycompat.xrange(len(web.repo) - 1, 0, -100):
+ for i in range(len(web.repo) - 1, 0, -100):
l = []
for j in cl.revs(max(0, i - 99), i):
ctx = web.repo[j]
--- a/mercurial/hgweb/webutil.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/hgweb/webutil.py Sun May 29 15:17:27 2022 +0200
@@ -720,7 +720,7 @@
len1 = lhi - llo
len2 = rhi - rlo
count = min(len1, len2)
- for i in pycompat.xrange(count):
+ for i in range(count):
yield _compline(
type=type,
leftlineno=llo + i + 1,
@@ -729,7 +729,7 @@
rightline=rightlines[rlo + i],
)
if len1 > len2:
- for i in pycompat.xrange(llo + count, lhi):
+ for i in range(llo + count, lhi):
yield _compline(
type=type,
leftlineno=i + 1,
@@ -738,7 +738,7 @@
rightline=None,
)
elif len2 > len1:
- for i in pycompat.xrange(rlo + count, rhi):
+ for i in range(rlo + count, rhi):
yield _compline(
type=type,
leftlineno=None,
--- a/mercurial/httppeer.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/httppeer.py Sun May 29 15:17:27 2022 +0200
@@ -55,7 +55,7 @@
result = []
n = 0
- for i in pycompat.xrange(0, len(value), valuelen):
+ for i in range(0, len(value), valuelen):
n += 1
result.append((fmt % str(n), pycompat.strurl(value[i : i + valuelen])))
--- a/mercurial/linelog.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/linelog.py Sun May 29 15:17:27 2022 +0200
@@ -293,7 +293,7 @@
% (expected, numentries)
)
instructions = [_eof(0, 0)]
- for offset in pycompat.xrange(1, numentries):
+ for offset in range(1, numentries):
instructions.append(_decodeone(buf, offset * _llentry.size))
return cls(instructions, maxrev=maxrev)
@@ -349,7 +349,7 @@
tgt = oldproglen + (b2 - b1 + 1)
# Jump to skip the insert if we're at an older revision.
appendinst(_jl(rev, tgt))
- for linenum in pycompat.xrange(b1, b2):
+ for linenum in range(b1, b2):
if _internal_blines is None:
bappend(lineinfo(rev, linenum, programlen()))
appendinst(_line(rev, linenum))
@@ -447,7 +447,7 @@
# only take as many steps as there are instructions in the
# program - if we don't find an EOF or our stop-line before
# then, something is badly broken.
- for step in pycompat.xrange(len(self._program)):
+ for step in range(len(self._program)):
inst = self._program[pc]
nextpc = pc + 1
if isinstance(inst, _jump):
--- a/mercurial/localrepo.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/localrepo.py Sun May 29 15:17:27 2022 +0200
@@ -1885,7 +1885,7 @@
# wdirrev isn't contiguous so the slice shouldn't include it
return [
self[i]
- for i in pycompat.xrange(*changeid.indices(len(self)))
+ for i in range(*changeid.indices(len(self)))
if i not in self.changelog.filteredrevs
]
--- a/mercurial/loggingutil.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/loggingutil.py Sun May 29 15:17:27 2022 +0200
@@ -11,7 +11,6 @@
from . import (
encoding,
- pycompat,
)
from .utils import (
@@ -54,7 +53,7 @@
else:
if st.st_size >= maxsize:
path = vfs.join(name)
- for i in pycompat.xrange(maxfiles - 1, 1, -1):
+ for i in range(maxfiles - 1, 1, -1):
rotate(
oldpath=b'%s.%d' % (path, i - 1),
newpath=b'%s.%d' % (path, i),
--- 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)
--- a/mercurial/minirst.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/minirst.py Sun May 29 15:17:27 2022 +0200
@@ -349,7 +349,7 @@
# position in bytes
columns = [
x
- for x in pycompat.xrange(len(div))
+ for x in range(len(div))
if div[x : x + 1] == b'=' and (x == 0 or div[x - 1 : x] == b' ')
]
rows = []
@@ -769,7 +769,7 @@
if llen and llen != plen:
collapse = False
s = []
- for j in pycompat.xrange(3, plen - 1):
+ for j in range(3, plen - 1):
parent = parents[j]
if j >= llen or lastparents[j] != parent:
s.append(len(blocks))
--- a/mercurial/obsolete.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/obsolete.py Sun May 29 15:17:27 2022 +0200
@@ -397,7 +397,7 @@
off = o3 + metasize * nummeta
metapairsize = unpack(b'>' + (metafmt * nummeta), data[o3:off])
metadata = []
- for idx in pycompat.xrange(0, len(metapairsize), 2):
+ for idx in range(0, len(metapairsize), 2):
o1 = off + metapairsize[idx]
o2 = o1 + metapairsize[idx + 1]
metadata.append((data[off:o1], data[o1:o2]))
--- a/mercurial/patch.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/patch.py Sun May 29 15:17:27 2022 +0200
@@ -864,9 +864,7 @@
for x, s in enumerate(self.lines):
self.hash.setdefault(s, []).append(x)
- for fuzzlen in pycompat.xrange(
- self.ui.configint(b"patch", b"fuzz") + 1
- ):
+ for fuzzlen in range(self.ui.configint(b"patch", b"fuzz") + 1):
for toponly in [True, False]:
old, oldstart, new, newstart = h.fuzzit(fuzzlen, toponly)
oldstart = oldstart + self.offset + self.skew
@@ -1431,7 +1429,7 @@
self.lena = int(aend) - self.starta
if self.starta:
self.lena += 1
- for x in pycompat.xrange(self.lena):
+ for x in range(self.lena):
l = lr.readline()
if l.startswith(b'---'):
# lines addition, old block is empty
@@ -1466,7 +1464,7 @@
if self.startb:
self.lenb += 1
hunki = 1
- for x in pycompat.xrange(self.lenb):
+ for x in range(self.lenb):
l = lr.readline()
if l.startswith(br'\ '):
# XXX: the only way to hit this is with an invalid line range.
@@ -1547,14 +1545,14 @@
top = 0
bot = 0
hlen = len(self.hunk)
- for x in pycompat.xrange(hlen - 1):
+ for x in range(hlen - 1):
# the hunk starts with the @@ line, so use x+1
if self.hunk[x + 1].startswith(b' '):
top += 1
else:
break
if not toponly:
- for x in pycompat.xrange(hlen - 1):
+ for x in range(hlen - 1):
if self.hunk[hlen - bot - 1].startswith(b' '):
bot += 1
else:
--- a/mercurial/phases.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/phases.py Sun May 29 15:17:27 2022 +0200
@@ -255,14 +255,14 @@
merge_after = r2[0] == rev + 1 and t2 == t
if merge_before and merge_after:
- data[idx - 1] = (pycompat.xrange(r1[0], r2[-1] + 1), t)
+ data[idx - 1] = (range(r1[0], r2[-1] + 1), t)
data.pop(idx)
elif merge_before:
- data[idx - 1] = (pycompat.xrange(r1[0], rev + 1), t)
+ data[idx - 1] = (range(r1[0], rev + 1), t)
elif merge_after:
- data[idx] = (pycompat.xrange(rev, r2[-1] + 1), t)
+ data[idx] = (range(rev, r2[-1] + 1), t)
else:
- data.insert(idx, (pycompat.xrange(rev, rev + 1), t))
+ data.insert(idx, (range(rev, rev + 1), t))
def _sortedrange_split(data, idx, rev, t):
@@ -274,16 +274,16 @@
data.pop(idx)
_sortedrange_insert(data, idx, rev, t)
elif r1[0] == rev:
- data[idx] = (pycompat.xrange(rev + 1, r1[-1] + 1), t1)
+ data[idx] = (range(rev + 1, r1[-1] + 1), t1)
_sortedrange_insert(data, idx, rev, t)
elif r1[-1] == rev:
- data[idx] = (pycompat.xrange(r1[0], rev), t1)
+ data[idx] = (range(r1[0], rev), t1)
_sortedrange_insert(data, idx + 1, rev, t)
else:
data[idx : idx + 1] = [
- (pycompat.xrange(r1[0], rev), t1),
- (pycompat.xrange(rev, rev + 1), t),
- (pycompat.xrange(rev + 1, r1[-1] + 1), t1),
+ (range(r1[0], rev), t1),
+ (range(rev, rev + 1), t),
+ (range(rev + 1, r1[-1] + 1), t1),
]
@@ -297,7 +297,7 @@
# If data is empty, create a one-revision range and done
if not data:
- data.insert(0, (pycompat.xrange(rev, rev + 1), (old, new)))
+ data.insert(0, (range(rev, rev + 1), (old, new)))
return
low = 0
@@ -333,14 +333,14 @@
low = mid + 1
if low == len(data):
- data.append((pycompat.xrange(rev, rev + 1), t))
+ data.append((range(rev, rev + 1), t))
return
r1, t1 = data[low]
if r1[0] > rev:
- data.insert(low, (pycompat.xrange(rev, rev + 1), t))
+ data.insert(low, (range(rev, rev + 1), t))
else:
- data.insert(low + 1, (pycompat.xrange(rev, rev + 1), t))
+ data.insert(low + 1, (range(rev, rev + 1), t))
class phasecache:
@@ -629,7 +629,7 @@
affected = set(repo.revs(b'(%ln::) - (%ln::)', new, old))
# find the phase of the affected revision
- for phase in pycompat.xrange(targetphase, -1, -1):
+ for phase in range(targetphase, -1, -1):
if phase:
roots = oldroots.get(phase, [])
revs = set(repo.revs(b'%ln::%ld', roots, affected))
--- a/mercurial/pvec.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/pvec.py Sun May 29 15:17:27 2022 +0200
@@ -75,7 +75,7 @@
def _str(v, l):
# type: (int, int) -> bytes
bs = b""
- for p in pycompat.xrange(l):
+ for p in range(l):
bs = pycompat.bytechr(v & 255) + bs
v >>= 8
return bs
@@ -99,7 +99,7 @@
return c
-_htab = [_hweight(x) for x in pycompat.xrange(256)]
+_htab = [_hweight(x) for x in range(256)]
def _hamming(a, b):
@@ -164,7 +164,7 @@
pvc = r._pveccache
if ctx.rev() not in pvc:
cl = r.changelog
- for n in pycompat.xrange(ctx.rev() + 1):
+ for n in range(ctx.rev() + 1):
if n not in pvc:
node = cl.node(n)
p1, p2 = cl.parentrevs(n)
--- a/mercurial/repair.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/repair.py Sun May 29 15:17:27 2022 +0200
@@ -24,7 +24,6 @@
obsutil,
pathutil,
phases,
- pycompat,
requirements,
scmutil,
util,
@@ -91,7 +90,7 @@
"""find out the filelogs affected by the strip"""
files = set()
- for x in pycompat.xrange(striprev, len(repo)):
+ for x in range(striprev, len(repo)):
files.update(repo[x].files())
return sorted(files)
--- a/mercurial/repoview.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/repoview.py Sun May 29 15:17:27 2022 +0200
@@ -168,7 +168,7 @@
firstmutable = min(firstmutable, min(cl.rev(r) for r in roots))
# protect from nullrev root
firstmutable = max(0, firstmutable)
- return frozenset(pycompat.xrange(firstmutable, len(cl)))
+ return frozenset(range(firstmutable, len(cl)))
# function to compute filtered set
@@ -264,7 +264,7 @@
class filteredchangelogmixin:
def tiprev(self):
"""filtered version of revlog.tiprev"""
- for i in pycompat.xrange(len(self) - 1, -2, -1):
+ for i in range(len(self) - 1, -2, -1):
if i not in self.filteredrevs:
return i
@@ -276,7 +276,7 @@
"""filtered version of revlog.__iter__"""
def filterediter():
- for i in pycompat.xrange(len(self)):
+ for i in range(len(self)):
if i not in self.filteredrevs:
yield i
--- a/mercurial/revlog.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/revlog.py Sun May 29 15:17:27 2022 +0200
@@ -743,7 +743,7 @@
return len(self.index)
def __iter__(self):
- return iter(pycompat.xrange(len(self)))
+ return iter(range(len(self)))
def revs(self, start=0, stop=None):
"""iterate over all rev in this revlog (from start to stop)"""
--- a/mercurial/revlogutils/revlogv0.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/revlogutils/revlogv0.py Sun May 29 15:17:27 2022 +0200
@@ -15,7 +15,6 @@
from .. import (
error,
node,
- pycompat,
revlogutils,
util,
)
@@ -77,7 +76,7 @@
def __delitem__(self, i):
if not isinstance(i, slice) or not i.stop == -1 or i.step is not None:
raise ValueError(b"deleting slices only supports a:-1 with step 1")
- for r in pycompat.xrange(i.start, len(self)):
+ for r in range(i.start, len(self)):
del self._nodemap[self[r][7]]
super(revlogoldindex, self).__delitem__(i)
--- a/mercurial/revsetlang.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/revsetlang.py Sun May 29 15:17:27 2022 +0200
@@ -75,7 +75,7 @@
+ pycompat.sysbytes(string.digits)
+ b'._@'
)
-) | set(map(pycompat.bytechr, pycompat.xrange(128, 256)))
+) | set(map(pycompat.bytechr, range(128, 256)))
# default set of valid characters for non-initial letters of symbols
_symletters = _syminitletters | set(pycompat.iterbytestr(b'-/'))
--- a/mercurial/scmutil.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/scmutil.py Sun May 29 15:17:27 2022 +0200
@@ -800,7 +800,7 @@
stopiteration = False
for windowsize in increasingwindows():
nrevs = []
- for i in pycompat.xrange(windowsize):
+ for i in range(windowsize):
rev = next(it, None)
if rev is None:
stopiteration = True
--- a/mercurial/server.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/server.py Sun May 29 15:17:27 2022 +0200
@@ -92,7 +92,7 @@
runargs.append(b'--daemon-postexec=unlink:%s' % lockpath)
# Don't pass --cwd to the child process, because we've already
# changed directory.
- for i in pycompat.xrange(1, len(runargs)):
+ for i in range(1, len(runargs)):
if runargs[i].startswith(b'--cwd='):
del runargs[i]
break
--- a/mercurial/shelve.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/shelve.py Sun May 29 15:17:27 2022 +0200
@@ -1010,8 +1010,7 @@
tr.close()
nodestoremove = [
- repo.changelog.node(rev)
- for rev in pycompat.xrange(oldtiprev, len(repo))
+ repo.changelog.node(rev) for rev in range(oldtiprev, len(repo))
]
shelvedstate.save(
repo,
--- a/mercurial/simplemerge.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/simplemerge.py Sun May 29 15:17:27 2022 +0200
@@ -21,7 +21,6 @@
from . import (
error,
mdiff,
- pycompat,
)
from .utils import stringutil
@@ -53,9 +52,7 @@
"""Compare a[astart:aend] == b[bstart:bend], without slicing."""
if (aend - astart) != (bend - bstart):
return False
- for ia, ib in zip(
- pycompat.xrange(astart, aend), pycompat.xrange(bstart, bend)
- ):
+ for ia, ib in zip(range(astart, aend), range(bstart, bend)):
if a[ia] != b[ib]:
return False
else:
--- a/mercurial/smartset.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/smartset.py Sun May 29 15:17:27 2022 +0200
@@ -152,11 +152,11 @@
# but start > stop is allowed, which should be an empty set.
ys = []
it = iter(self)
- for x in pycompat.xrange(start):
+ for x in range(start):
y = next(it, None)
if y is None:
break
- for x in pycompat.xrange(stop - start):
+ for x in range(stop - start):
y = next(it, None)
if y is None:
break
@@ -1030,13 +1030,13 @@
return self.fastdesc()
def fastasc(self):
- iterrange = pycompat.xrange(self._start, self._end)
+ iterrange = range(self._start, self._end)
if self._hiddenrevs:
return self._iterfilter(iterrange)
return iter(iterrange)
def fastdesc(self):
- iterrange = pycompat.xrange(self._end - 1, self._start - 1, -1)
+ iterrange = range(self._end - 1, self._start - 1, -1)
if self._hiddenrevs:
return self._iterfilter(iterrange)
return iter(iterrange)
--- a/mercurial/store.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/store.py Sun May 29 15:17:27 2022 +0200
@@ -150,7 +150,7 @@
def decode(s):
i = 0
while i < len(s):
- for l in pycompat.xrange(1, 4):
+ for l in range(1, 4):
try:
yield dmap[s[i : i + l]]
i += l
@@ -161,9 +161,7 @@
raise KeyError
return (
- lambda s: b''.join(
- [cmap[s[c : c + 1]] for c in pycompat.xrange(len(s))]
- ),
+ lambda s: b''.join([cmap[s[c : c + 1]] for c in range(len(s))]),
lambda s: b''.join(list(decode(s))),
)
@@ -200,7 +198,7 @@
'the~07quick~adshot'
"""
xchr = pycompat.bytechr
- cmap = {xchr(x): xchr(x) for x in pycompat.xrange(127)}
+ cmap = {xchr(x): xchr(x) for x in range(127)}
for x in _reserved():
cmap[xchr(x)] = b"~%02x" % x
for x in range(ord(b"A"), ord(b"Z") + 1):
--- a/mercurial/streamclone.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/streamclone.py Sun May 29 15:17:27 2022 +0200
@@ -426,7 +426,7 @@
with repo.transaction(b'clone'):
with repo.svfs.backgroundclosing(repo.ui, expectedcount=filecount):
- for i in pycompat.xrange(filecount):
+ for i in range(filecount):
# XXX doesn't support '\n' or '\r' in filenames
l = fp.readline()
try:
--- a/mercurial/templatefilters.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/templatefilters.py Sun May 29 15:17:27 2022 +0200
@@ -140,7 +140,7 @@
b = b[: len(a)]
if a == b:
return a
- for i in pycompat.xrange(len(a)):
+ for i in range(len(a)):
if a[i] != b[i]:
return a[:i]
return a
@@ -311,7 +311,7 @@
endswithnewline = text[-1:] == b'\n'
def indenter():
- for i in pycompat.xrange(num_lines):
+ for i in range(num_lines):
l = lines[i]
if l.strip():
yield prefix if i else firstline
--- a/mercurial/treediscovery.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/treediscovery.py Sun May 29 15:17:27 2022 +0200
@@ -12,7 +12,6 @@
from .node import short
from . import (
error,
- pycompat,
)
@@ -116,7 +115,7 @@
repo.ui.debug(
b"request %d: %s\n" % (reqcnt, b" ".join(map(short, r)))
)
- for p in pycompat.xrange(0, len(r), 10):
+ for p in range(0, len(r), 10):
with remote.commandexecutor() as e:
subset = r[p : p + 10]
if audit is not None:
--- a/mercurial/utils/storageutil.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/utils/storageutil.py Sun May 29 15:17:27 2022 +0200
@@ -19,7 +19,6 @@
dagop,
error,
mdiff,
- pycompat,
)
from ..interfaces import repository
from ..revlogutils import sidedata as sidedatamod
@@ -181,7 +180,7 @@
else:
stop = storelen
- return pycompat.xrange(start, stop, step)
+ return range(start, stop, step)
def fileidlookup(store, fileid, identifier):
--- a/mercurial/utils/stringutil.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/utils/stringutil.py Sun May 29 15:17:27 2022 +0200
@@ -750,7 +750,7 @@
def _cutdown(self, ucstr, space_left):
l = 0
colwidth = encoding.ucolwidth
- for i in pycompat.xrange(len(ucstr)):
+ for i in range(len(ucstr)):
l += colwidth(ucstr[i])
if space_left < l:
return (ucstr[:i], ucstr[i:])
--- a/mercurial/win32.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/win32.py Sun May 29 15:17:27 2022 +0200
@@ -732,7 +732,7 @@
# callers to recreate f immediately while having other readers do their
# implicit zombie filename blocking on a temporary name.
- for tries in pycompat.xrange(10):
+ for tries in range(10):
temp = b'%s-%08x' % (f, random.randint(0, 0xFFFFFFFF))
try:
os.rename(f, temp) # raises OSError EEXIST if temp exists
--- a/mercurial/wireprotoserver.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/wireprotoserver.py Sun May 29 15:17:27 2022 +0200
@@ -390,14 +390,14 @@
def getargs(self, args):
data = {}
keys = args.split()
- for n in pycompat.xrange(len(keys)):
+ for n in range(len(keys)):
argline = self._fin.readline()[:-1]
arg, l = argline.split()
if arg not in keys:
raise error.Abort(_(b"unexpected parameter %r") % arg)
if arg == b'*':
star = {}
- for k in pycompat.xrange(int(l)):
+ for k in range(int(l)):
argline = self._fin.readline()[:-1]
arg, l = argline.split()
val = self._fin.read(int(l))
--- a/mercurial/wireprotov1peer.py Sun May 29 12:38:54 2022 +0200
+++ b/mercurial/wireprotov1peer.py Sun May 29 15:17:27 2022 +0200
@@ -519,7 +519,7 @@
def between(self, pairs):
batch = 8 # avoid giant requests
r = []
- for i in pycompat.xrange(0, len(pairs), batch):
+ for i in range(0, len(pairs), batch):
n = b" ".join(
[
wireprototypes.encodelist(p, b'-')
--- a/tests/test-remotefilelog-datapack.py Sun May 29 12:38:54 2022 +0200
+++ b/tests/test-remotefilelog-datapack.py Sun May 29 15:17:27 2022 +0200
@@ -267,7 +267,7 @@
revisions = []
blobs = {}
total = basepack.SMALLFANOUTCUTOFF + 1
- for i in pycompat.xrange(total):
+ for i in range(total):
filename = b"filename-%d" % i
content = filename
node = self.getHash(content)
@@ -357,7 +357,7 @@
]
for packsize in packsizes:
revisions = []
- for i in pycompat.xrange(packsize):
+ for i in range(packsize):
filename = b"filename-%d" % i
content = b"content-%d" % i
node = self.getHash(content)
--- a/tests/test-remotefilelog-histpack.py Sun May 29 12:38:54 2022 +0200
+++ b/tests/test-remotefilelog-histpack.py Sun May 29 15:17:27 2022 +0200
@@ -283,7 +283,7 @@
This causes it to use a 2^16 fanout table instead."""
total = basepack.SMALLFANOUTCUTOFF + 1
revisions = []
- for i in pycompat.xrange(total):
+ for i in range(total):
filename = b"foo-%d" % i
node = self.getFakeHash()
p1 = self.getFakeHash()