hgext/hgk.py
changeset 49292 d44e3c45f0e4
parent 49004 f254fc73d956
equal deleted inserted replaced
49291:44b26349127b 49292:d44e3c45f0e4
   243                 chunk = i
   243                 chunk = i
   244                 i = 0
   244                 i = 0
   245             else:
   245             else:
   246                 i -= chunk
   246                 i -= chunk
   247 
   247 
   248             for x in pycompat.xrange(chunk):
   248             for x in range(chunk):
   249                 if i + x >= count:
   249                 if i + x >= count:
   250                     l[chunk - x :] = [0] * (chunk - x)
   250                     l[chunk - x :] = [0] * (chunk - x)
   251                     break
   251                     break
   252                 if full is not None:
   252                 if full is not None:
   253                     if (i + x) in repo:
   253                     if (i + x) in repo:
   254                         l[x] = repo[i + x]
   254                         l[x] = repo[i + x]
   255                         l[x].changeset()  # force reading
   255                         l[x].changeset()  # force reading
   256                 else:
   256                 else:
   257                     if (i + x) in repo:
   257                     if (i + x) in repo:
   258                         l[x] = 1
   258                         l[x] = 1
   259             for x in pycompat.xrange(chunk - 1, -1, -1):
   259             for x in range(chunk - 1, -1, -1):
   260                 if l[x] != 0:
   260                 if l[x] != 0:
   261                     yield (i + x, full is not None and l[x] or None)
   261                     yield (i + x, full is not None and l[x] or None)
   262             if i == 0:
   262             if i == 0:
   263                 break
   263                 break
   264 
   264 
   265     # calculate and return the reachability bitmask for sha
   265     # calculate and return the reachability bitmask for sha
   266     def is_reachable(ar, reachable, sha):
   266     def is_reachable(ar, reachable, sha):
   267         if len(ar) == 0:
   267         if len(ar) == 0:
   268             return 1
   268             return 1
   269         mask = 0
   269         mask = 0
   270         for i in pycompat.xrange(len(ar)):
   270         for i in range(len(ar)):
   271             if sha in reachable[i]:
   271             if sha in reachable[i]:
   272                 mask |= 1 << i
   272                 mask |= 1 << i
   273 
   273 
   274         return mask
   274         return mask
   275 
   275