Mercurial > public > mercurial-scm > hg
comparison mercurial/pvec.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 | d718eddf01d9 |
comparison
equal
deleted
inserted
replaced
49283:44b26349127b | 49284:d44e3c45f0e4 |
---|---|
73 | 73 |
74 | 74 |
75 def _str(v, l): | 75 def _str(v, l): |
76 # type: (int, int) -> bytes | 76 # type: (int, int) -> bytes |
77 bs = b"" | 77 bs = b"" |
78 for p in pycompat.xrange(l): | 78 for p in range(l): |
79 bs = pycompat.bytechr(v & 255) + bs | 79 bs = pycompat.bytechr(v & 255) + bs |
80 v >>= 8 | 80 v >>= 8 |
81 return bs | 81 return bs |
82 | 82 |
83 | 83 |
97 c += 1 | 97 c += 1 |
98 x >>= 1 | 98 x >>= 1 |
99 return c | 99 return c |
100 | 100 |
101 | 101 |
102 _htab = [_hweight(x) for x in pycompat.xrange(256)] | 102 _htab = [_hweight(x) for x in range(256)] |
103 | 103 |
104 | 104 |
105 def _hamming(a, b): | 105 def _hamming(a, b): |
106 '''find the hamming distance between two longs''' | 106 '''find the hamming distance between two longs''' |
107 d = a ^ b | 107 d = a ^ b |
162 if not util.safehasattr(r, "_pveccache"): | 162 if not util.safehasattr(r, "_pveccache"): |
163 r._pveccache = {} | 163 r._pveccache = {} |
164 pvc = r._pveccache | 164 pvc = r._pveccache |
165 if ctx.rev() not in pvc: | 165 if ctx.rev() not in pvc: |
166 cl = r.changelog | 166 cl = r.changelog |
167 for n in pycompat.xrange(ctx.rev() + 1): | 167 for n in range(ctx.rev() + 1): |
168 if n not in pvc: | 168 if n not in pvc: |
169 node = cl.node(n) | 169 node = cl.node(n) |
170 p1, p2 = cl.parentrevs(n) | 170 p1, p2 = cl.parentrevs(n) |
171 if p1 == nullrev: | 171 if p1 == nullrev: |
172 # start with a 'random' vector at root | 172 # start with a 'random' vector at root |