Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 38823: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 | 0a57945aaf7f |
children | 1d1c1645d7b9 |
comparison
equal
deleted
inserted
replaced
38822:7eba8f83129b | 38823:e7aa113b14f7 |
---|---|
175 total += 1 | 175 total += 1 |
176 | 176 |
177 if mergeable_file: | 177 if mergeable_file: |
178 linesperrev = 2 | 178 linesperrev = 2 |
179 # make a file with k lines per rev | 179 # make a file with k lines per rev |
180 initialmergedlines = ['%d' % i for i in xrange(0, total * linesperrev)] | 180 initialmergedlines = ['%d' % i |
181 for i in pycompat.xrange(0, total * linesperrev)] | |
181 initialmergedlines.append("") | 182 initialmergedlines.append("") |
182 | 183 |
183 tags = [] | 184 tags = [] |
184 progress = ui.makeprogress(_('building'), unit=_('revisions'), | 185 progress = ui.makeprogress(_('building'), unit=_('revisions'), |
185 total=total) | 186 total=total) |
2016 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2" | 2017 ui.write(("# rev p1rev p2rev start end deltastart base p1 p2" |
2017 " rawsize totalsize compression heads chainlen\n")) | 2018 " rawsize totalsize compression heads chainlen\n")) |
2018 ts = 0 | 2019 ts = 0 |
2019 heads = set() | 2020 heads = set() |
2020 | 2021 |
2021 for rev in xrange(numrevs): | 2022 for rev in pycompat.xrange(numrevs): |
2022 dbase = r.deltaparent(rev) | 2023 dbase = r.deltaparent(rev) |
2023 if dbase == -1: | 2024 if dbase == -1: |
2024 dbase = rev | 2025 dbase = rev |
2025 cbase = r.chainbase(rev) | 2026 cbase = r.chainbase(rev) |
2026 clen = r.chainlen(rev) | 2027 clen = r.chainlen(rev) |
2077 if size > l[1]: | 2078 if size > l[1]: |
2078 l[1] = size | 2079 l[1] = size |
2079 l[2] += size | 2080 l[2] += size |
2080 | 2081 |
2081 numrevs = len(r) | 2082 numrevs = len(r) |
2082 for rev in xrange(numrevs): | 2083 for rev in pycompat.xrange(numrevs): |
2083 p1, p2 = r.parentrevs(rev) | 2084 p1, p2 = r.parentrevs(rev) |
2084 delta = r.deltaparent(rev) | 2085 delta = r.deltaparent(rev) |
2085 if format > 0: | 2086 if format > 0: |
2086 addsize(r.rawsize(rev), datasize) | 2087 addsize(r.rawsize(rev), datasize) |
2087 if p2 != nullrev: | 2088 if p2 != nullrev: |