# HG changeset patch # User pacien # Date 2023-05-22 17:04:05 # Node ID 4fd2f7ab4177f0b3dedc99319fe090ab8f2883c3 # Parent 1a4f54574e3d63fdd5d6ad6285245e6b281d76b5 stabletailgraph: clarify excl part size computation diff --git a/mercurial/stabletailgraph/stabletailsort.py b/mercurial/stabletailgraph/stabletailsort.py --- a/mercurial/stabletailgraph/stabletailsort.py +++ b/mercurial/stabletailgraph/stabletailsort.py @@ -108,6 +108,9 @@ def _stable_tail_sort_naive(cl, head_rev if a not in tail_ancestors ) + # Notice that excl(cur) is disjoint from ancestors(pt), + # so there is no double-counting: + # rank(cur) = len([cur]) + len(excl(cur)) + rank(pt) excl_part_size = cl.fast_rank(cursor_rev) - cl.fast_rank(pt) - 1 yield from itertools.islice(exclusive_ancestors, excl_part_size) cursor_rev = pt