Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/graphmod.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 | 24e517600b29 |
children | 3c4b2e880273 |
comparison
equal
deleted
inserted
replaced
38822:7eba8f83129b | 38823:e7aa113b14f7 |
---|---|
20 from __future__ import absolute_import | 20 from __future__ import absolute_import |
21 | 21 |
22 from .node import nullrev | 22 from .node import nullrev |
23 from . import ( | 23 from . import ( |
24 dagop, | 24 dagop, |
25 pycompat, | |
25 smartset, | 26 smartset, |
26 util, | 27 util, |
27 ) | 28 ) |
28 | 29 |
29 CHANGESET = 'C' | 30 CHANGESET = 'C' |
424 state['lastcoldiff'], fix_nodeline_tail)) | 425 state['lastcoldiff'], fix_nodeline_tail)) |
425 | 426 |
426 # shift_interline is the line containing the non-vertical | 427 # shift_interline is the line containing the non-vertical |
427 # edges between this entry and the next | 428 # edges between this entry and the next |
428 shift_interline = echars[:idx * 2] | 429 shift_interline = echars[:idx * 2] |
429 for i in xrange(2 + coldiff): | 430 for i in pycompat.xrange(2 + coldiff): |
430 shift_interline.append(' ') | 431 shift_interline.append(' ') |
431 count = ncols - idx - 1 | 432 count = ncols - idx - 1 |
432 if coldiff == -1: | 433 if coldiff == -1: |
433 for i in xrange(count): | 434 for i in pycompat.xrange(count): |
434 shift_interline.extend(['/', ' ']) | 435 shift_interline.extend(['/', ' ']) |
435 elif coldiff == 0: | 436 elif coldiff == 0: |
436 shift_interline.extend(echars[(idx + 1) * 2:ncols * 2]) | 437 shift_interline.extend(echars[(idx + 1) * 2:ncols * 2]) |
437 else: | 438 else: |
438 for i in xrange(count): | 439 for i in pycompat.xrange(count): |
439 shift_interline.extend(['\\', ' ']) | 440 shift_interline.extend(['\\', ' ']) |
440 | 441 |
441 # draw edges from the current node to its parents | 442 # draw edges from the current node to its parents |
442 _drawedges(echars, edges, nodeline, shift_interline) | 443 _drawedges(echars, edges, nodeline, shift_interline) |
443 | 444 |