Mercurial > hg
comparison mercurial/cmdutil.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 | e252f136b948 |
children | 32ece991955c |
comparison
equal
deleted
inserted
replaced
38782:7eba8f83129b | 38783:e7aa113b14f7 |
---|---|
1753 Returns an iterator yielding (linkrev, parentlinkrevs, copied) | 1753 Returns an iterator yielding (linkrev, parentlinkrevs, copied) |
1754 tuples in backwards order | 1754 tuples in backwards order |
1755 """ | 1755 """ |
1756 cl_count = len(repo) | 1756 cl_count = len(repo) |
1757 revs = [] | 1757 revs = [] |
1758 for j in xrange(0, last + 1): | 1758 for j in pycompat.xrange(0, last + 1): |
1759 linkrev = filelog.linkrev(j) | 1759 linkrev = filelog.linkrev(j) |
1760 if linkrev < minrev: | 1760 if linkrev < minrev: |
1761 continue | 1761 continue |
1762 # only yield rev for which we have the changelog, it can | 1762 # only yield rev for which we have the changelog, it can |
1763 # happen while doing "hg log" during a pull or commit | 1763 # happen while doing "hg log" during a pull or commit |
1964 # is descending and the prune args are all within that range | 1964 # is descending and the prune args are all within that range |
1965 for rev in opts.get('prune', ()): | 1965 for rev in opts.get('prune', ()): |
1966 rev = repo[rev].rev() | 1966 rev = repo[rev].rev() |
1967 ff = _followfilter(repo) | 1967 ff = _followfilter(repo) |
1968 stop = min(revs[0], revs[-1]) | 1968 stop = min(revs[0], revs[-1]) |
1969 for x in xrange(rev, stop - 1, -1): | 1969 for x in pycompat.xrange(rev, stop - 1, -1): |
1970 if ff.match(x): | 1970 if ff.match(x): |
1971 wanted = wanted - [x] | 1971 wanted = wanted - [x] |
1972 | 1972 |
1973 # Now that wanted is correctly initialized, we can iterate over the | 1973 # Now that wanted is correctly initialized, we can iterate over the |
1974 # revision range, yielding only revisions in wanted. | 1974 # revision range, yielding only revisions in wanted. |
1983 | 1983 |
1984 it = iter(revs) | 1984 it = iter(revs) |
1985 stopiteration = False | 1985 stopiteration = False |
1986 for windowsize in increasingwindows(): | 1986 for windowsize in increasingwindows(): |
1987 nrevs = [] | 1987 nrevs = [] |
1988 for i in xrange(windowsize): | 1988 for i in pycompat.xrange(windowsize): |
1989 rev = next(it, None) | 1989 rev = next(it, None) |
1990 if rev is None: | 1990 if rev is None: |
1991 stopiteration = True | 1991 stopiteration = True |
1992 break | 1992 break |
1993 elif want(rev): | 1993 elif want(rev): |