mercurial/stabletailgraph/stabletailsort.py
changeset 50526 4fd2f7ab4177
parent 50525 1a4f54574e3d
child 50527 dc372251d4dc
equal deleted inserted replaced
50525:1a4f54574e3d 50526:4fd2f7ab4177
   106                 a
   106                 a
   107                 for a in _stable_tail_sort_naive(cl, px)
   107                 for a in _stable_tail_sort_naive(cl, px)
   108                 if a not in tail_ancestors
   108                 if a not in tail_ancestors
   109             )
   109             )
   110 
   110 
       
   111             # Notice that excl(cur) is disjoint from ancestors(pt),
       
   112             # so there is no double-counting:
       
   113             # rank(cur) = len([cur]) + len(excl(cur)) + rank(pt)
   111             excl_part_size = cl.fast_rank(cursor_rev) - cl.fast_rank(pt) - 1
   114             excl_part_size = cl.fast_rank(cursor_rev) - cl.fast_rank(pt) - 1
   112             yield from itertools.islice(exclusive_ancestors, excl_part_size)
   115             yield from itertools.islice(exclusive_ancestors, excl_part_size)
   113             cursor_rev = pt
   116             cursor_rev = pt