Mercurial > public > mercurial-scm > hg
comparison mercurial/phases.py @ 38783:e7aa113b14f7
global: use pycompat.xrange()
On Python 3, our module importer automatically rewrites xrange()
to pycompat.xrange().
We want to move away from the custom importer on Python 3.
This commit converts all instances of xrange() to use
pycompat.xrange().
Differential Revision: https://phab.mercurial-scm.org/D4032
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 01 Aug 2018 13:00:45 -0700 |
parents | ddd2165438cd |
children | b95b48a55c36 |
comparison
equal
deleted
inserted
replaced
38782:7eba8f83129b | 38783:e7aa113b14f7 |
---|---|
372 | 372 |
373 repo = repo.unfiltered() | 373 repo = repo.unfiltered() |
374 | 374 |
375 changes = set() # set of revisions to be changed | 375 changes = set() # set of revisions to be changed |
376 delroots = [] # set of root deleted by this path | 376 delroots = [] # set of root deleted by this path |
377 for phase in xrange(targetphase + 1, len(allphases)): | 377 for phase in pycompat.xrange(targetphase + 1, len(allphases)): |
378 # filter nodes that are not in a compatible phase already | 378 # filter nodes that are not in a compatible phase already |
379 nodes = [n for n in nodes | 379 nodes = [n for n in nodes |
380 if self.phase(repo, repo[n].rev()) >= phase] | 380 if self.phase(repo, repo[n].rev()) >= phase] |
381 if not nodes: | 381 if not nodes: |
382 break # no roots to move anymore | 382 break # no roots to move anymore |
418 new = self.phaseroots[targetphase] | 418 new = self.phaseroots[targetphase] |
419 old = oldroots[targetphase] | 419 old = oldroots[targetphase] |
420 affected = set(repo.revs('(%ln::) - (%ln::)', new, old)) | 420 affected = set(repo.revs('(%ln::) - (%ln::)', new, old)) |
421 | 421 |
422 # find the phase of the affected revision | 422 # find the phase of the affected revision |
423 for phase in xrange(targetphase, -1, -1): | 423 for phase in pycompat.xrange(targetphase, -1, -1): |
424 if phase: | 424 if phase: |
425 roots = oldroots[phase] | 425 roots = oldroots[phase] |
426 revs = set(repo.revs('%ln::%ld', roots, affected)) | 426 revs = set(repo.revs('%ln::%ld', roots, affected)) |
427 affected -= revs | 427 affected -= revs |
428 else: # public phase | 428 else: # public phase |