Mercurial > public > mercurial-scm > hg
comparison mercurial/grep.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 | 2e726c934fcd |
comparison
equal
deleted
inserted
replaced
49283:44b26349127b | 49284:d44e3c45f0e4 |
---|---|
65 | 65 |
66 def difflinestates(a, b): | 66 def difflinestates(a, b): |
67 sm = difflib.SequenceMatcher(None, a, b) | 67 sm = difflib.SequenceMatcher(None, a, b) |
68 for tag, alo, ahi, blo, bhi in sm.get_opcodes(): | 68 for tag, alo, ahi, blo, bhi in sm.get_opcodes(): |
69 if tag == 'insert': | 69 if tag == 'insert': |
70 for i in pycompat.xrange(blo, bhi): | 70 for i in range(blo, bhi): |
71 yield (b'+', b[i]) | 71 yield (b'+', b[i]) |
72 elif tag == 'delete': | 72 elif tag == 'delete': |
73 for i in pycompat.xrange(alo, ahi): | 73 for i in range(alo, ahi): |
74 yield (b'-', a[i]) | 74 yield (b'-', a[i]) |
75 elif tag == 'replace': | 75 elif tag == 'replace': |
76 for i in pycompat.xrange(alo, ahi): | 76 for i in range(alo, ahi): |
77 yield (b'-', a[i]) | 77 yield (b'-', a[i]) |
78 for i in pycompat.xrange(blo, bhi): | 78 for i in range(blo, bhi): |
79 yield (b'+', b[i]) | 79 yield (b'+', b[i]) |
80 | 80 |
81 | 81 |
82 class grepsearcher: | 82 class grepsearcher: |
83 """Search files and revisions for lines matching the given pattern | 83 """Search files and revisions for lines matching the given pattern |