pvec: don't use xrange
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 22 Jun 2015 00:17:35 -0700
changeset 25878 a3906deedd0a2d657a4b4321777d0a09776d6d0a
parent 25877 c66b2e6ec8b5d67a047681ca072c53e05e9dc5a1
child 25879 e660bb9b6fc9666f2641599b6a017894cf3b9c95
push id14
push usergszorc@mozilla.com
push dateMon, 22 Jun 2015 07:28:19 +0000
pvec: don't use xrange
mercurial/pvec.py
--- a/mercurial/pvec.py
+++ b/mercurial/pvec.py
@@ -64,17 +64,17 @@ def _bin(bs):
     '''convert a bytestring to a long'''
     v = 0
     for b in bs:
         v = v * 256 + ord(b)
     return v
 
 def _str(v, l):
     bs = ""
-    for p in xrange(l):
+    for p in range(l):
         bs = chr(v & 255) + bs
         v >>= 8
     return bs
 
 def _split(b):
     '''depth and bitvec'''
     return _bin(b[:_depthbytes]), _bin(b[_depthbytes:])
 
@@ -83,17 +83,17 @@ def _join(depth, bitvec):
 
 def _hweight(x):
     c = 0
     while x:
         if x & 1:
             c += 1
         x >>= 1
     return c
-_htab = [_hweight(x) for x in xrange(256)]
+_htab = [_hweight(x) for x in range(256)]
 
 def _hamming(a, b):
     '''find the hamming distance between two longs'''
     d = a ^ b
     c = 0
     while d:
         c += _htab[d & 0xff]
         d >>= 8
@@ -144,17 +144,17 @@ def _flipbit(v, node):
 def ctxpvec(ctx):
     '''construct a pvec for ctx while filling in the cache'''
     r = ctx.repo()
     if not util.safehasattr(r, "_pveccache"):
         r._pveccache = {}
     pvc = r._pveccache
     if ctx.rev() not in pvc:
         cl = r.changelog
-        for n in xrange(ctx.rev() + 1):
+        for n in range(ctx.rev() + 1):
             if n not in pvc:
                 node = cl.node(n)
                 p1, p2 = cl.parentrevs(n)
                 if p1 == nullrev:
                     # start with a 'random' vector at root
                     pvc[n] = (0, _bin((node * 3)[:_vecbytes]))
                 elif p2 == nullrev:
                     d, v = pvc[p1]