Mercurial > public > mercurial-scm > hg
comparison hgext/fastannotate/context.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 | e586a7eb380a |
comparison
equal
deleted
inserted
replaced
49283:44b26349127b | 49284:d44e3c45f0e4 |
---|---|
73 def _decorate(fctx): | 73 def _decorate(fctx): |
74 text = fctx.data() | 74 text = fctx.data() |
75 linecount = text.count(b'\n') | 75 linecount = text.count(b'\n') |
76 if text and not text.endswith(b'\n'): | 76 if text and not text.endswith(b'\n'): |
77 linecount += 1 | 77 linecount += 1 |
78 return ([(fctx, i) for i in pycompat.xrange(linecount)], text) | 78 return ([(fctx, i) for i in range(linecount)], text) |
79 | 79 |
80 | 80 |
81 # extracted from mercurial.context.basefilectx.annotate. slightly modified | 81 # extracted from mercurial.context.basefilectx.annotate. slightly modified |
82 # so it takes an extra "blocks" parameter calculated elsewhere, instead of | 82 # so it takes an extra "blocks" parameter calculated elsewhere, instead of |
83 # calculating diff here. | 83 # calculating diff here. |
575 # [llrev] | 575 # [llrev] |
576 revs = [revmap.hsh2rev(l[0]) for l in annotateresult] | 576 revs = [revmap.hsh2rev(l[0]) for l in annotateresult] |
577 result = [None] * len(annotateresult) | 577 result = [None] * len(annotateresult) |
578 # {(rev, linenum): [lineindex]} | 578 # {(rev, linenum): [lineindex]} |
579 key2idxs = collections.defaultdict(list) | 579 key2idxs = collections.defaultdict(list) |
580 for i in pycompat.xrange(len(result)): | 580 for i in range(len(result)): |
581 key2idxs[(revs[i], annotateresult[i][1])].append(i) | 581 key2idxs[(revs[i], annotateresult[i][1])].append(i) |
582 while key2idxs: | 582 while key2idxs: |
583 # find an unresolved line and its linelog rev to annotate | 583 # find an unresolved line and its linelog rev to annotate |
584 hsh = None | 584 hsh = None |
585 try: | 585 try: |