hgext/hgk.py
changeset 38783 e7aa113b14f7
parent 36790 cb0afaf112e8
child 40293 c303d65d2e34
equal deleted inserted replaced
38782:7eba8f83129b 38783:e7aa113b14f7
   225                 chunk = i
   225                 chunk = i
   226                 i = 0
   226                 i = 0
   227             else:
   227             else:
   228                 i -= chunk
   228                 i -= chunk
   229 
   229 
   230             for x in xrange(chunk):
   230             for x in pycompat.xrange(chunk):
   231                 if i + x >= count:
   231                 if i + x >= count:
   232                     l[chunk - x:] = [0] * (chunk - x)
   232                     l[chunk - x:] = [0] * (chunk - x)
   233                     break
   233                     break
   234                 if full is not None:
   234                 if full is not None:
   235                     if (i + x) in repo:
   235                     if (i + x) in repo:
   236                         l[x] = repo[i + x]
   236                         l[x] = repo[i + x]
   237                         l[x].changeset() # force reading
   237                         l[x].changeset() # force reading
   238                 else:
   238                 else:
   239                     if (i + x) in repo:
   239                     if (i + x) in repo:
   240                         l[x] = 1
   240                         l[x] = 1
   241             for x in xrange(chunk - 1, -1, -1):
   241             for x in pycompat.xrange(chunk - 1, -1, -1):
   242                 if l[x] != 0:
   242                 if l[x] != 0:
   243                     yield (i + x, full is not None and l[x] or None)
   243                     yield (i + x, full is not None and l[x] or None)
   244             if i == 0:
   244             if i == 0:
   245                 break
   245                 break
   246 
   246 
   247     # calculate and return the reachability bitmask for sha
   247     # calculate and return the reachability bitmask for sha
   248     def is_reachable(ar, reachable, sha):
   248     def is_reachable(ar, reachable, sha):
   249         if len(ar) == 0:
   249         if len(ar) == 0:
   250             return 1
   250             return 1
   251         mask = 0
   251         mask = 0
   252         for i in xrange(len(ar)):
   252         for i in pycompat.xrange(len(ar)):
   253             if sha in reachable[i]:
   253             if sha in reachable[i]:
   254                 mask |= 1 << i
   254                 mask |= 1 << i
   255 
   255 
   256         return mask
   256         return mask
   257 
   257