comparison mercurial/changegroup.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 9cac281eb9c0
comparison
equal deleted inserted replaced
49283:44b26349127b 49284:d44e3c45f0e4
418 needfiles = {} 418 needfiles = {}
419 if repo.ui.configbool(b'server', b'validate'): 419 if repo.ui.configbool(b'server', b'validate'):
420 cl = repo.changelog 420 cl = repo.changelog
421 ml = repo.manifestlog 421 ml = repo.manifestlog
422 # validate incoming csets have their manifests 422 # validate incoming csets have their manifests
423 for cset in pycompat.xrange(clstart, clend): 423 for cset in range(clstart, clend):
424 mfnode = cl.changelogrevision(cset).manifest 424 mfnode = cl.changelogrevision(cset).manifest
425 mfest = ml[mfnode].readdelta() 425 mfest = ml[mfnode].readdelta()
426 # store file nodes we must see 426 # store file nodes we must see
427 for f, n in mfest.items(): 427 for f, n in mfest.items():
428 needfiles.setdefault(f, set()).add(n) 428 needfiles.setdefault(f, set()).add(n)
507 b'pretxnchangegroup', 507 b'pretxnchangegroup',
508 throw=True, 508 throw=True,
509 **pycompat.strkwargs(hookargs) 509 **pycompat.strkwargs(hookargs)
510 ) 510 )
511 511
512 added = pycompat.xrange(clstart, clend) 512 added = range(clstart, clend)
513 phaseall = None 513 phaseall = None
514 if srctype in (b'push', b'serve'): 514 if srctype in (b'push', b'serve'):
515 # Old servers can not push the boundary themselves. 515 # Old servers can not push the boundary themselves.
516 # New servers won't push the boundary if changeset already 516 # New servers won't push the boundary if changeset already
517 # exists locally as secret 517 # exists locally as secret
823 # a fact - it works for all the (admittedly 823 # a fact - it works for all the (admittedly
824 # thorough) cases in our testsuite, but I would be 824 # thorough) cases in our testsuite, but I would be
825 # somewhat unsurprised to find a case in the wild 825 # somewhat unsurprised to find a case in the wild
826 # where this breaks down a bit. That said, I don't 826 # where this breaks down a bit. That said, I don't
827 # know if it would hurt anything. 827 # know if it would hurt anything.
828 for i in pycompat.xrange(rev, 0, -1): 828 for i in range(rev, 0, -1):
829 if store.linkrev(i) == clrev: 829 if store.linkrev(i) == clrev:
830 return i 830 return i
831 # We failed to resolve a parent for this node, so 831 # We failed to resolve a parent for this node, so
832 # we crash the changegroup construction. 832 # we crash the changegroup construction.
833 if util.safehasattr(store, 'target'): 833 if util.safehasattr(store, 'target'):
1954 except error.CensoredBaseError as e: 1954 except error.CensoredBaseError as e:
1955 raise error.Abort(_(b"received delta base is censored: %s") % e) 1955 raise error.Abort(_(b"received delta base is censored: %s") % e)
1956 revisions += len(fl) - o 1956 revisions += len(fl) - o
1957 if f in needfiles: 1957 if f in needfiles:
1958 needs = needfiles[f] 1958 needs = needfiles[f]
1959 for new in pycompat.xrange(o, len(fl)): 1959 for new in range(o, len(fl)):
1960 n = fl.node(new) 1960 n = fl.node(new)
1961 if n in needs: 1961 if n in needs:
1962 needs.remove(n) 1962 needs.remove(n)
1963 else: 1963 else:
1964 raise error.Abort(_(b"received spurious file revlog entry")) 1964 raise error.Abort(_(b"received spurious file revlog entry"))