changeset 50526:4fd2f7ab4177

stabletailgraph: clarify excl part size computation
author pacien <pacien.trangirard@pacien.net>
date Mon, 22 May 2023 19:04:05 +0200
parents 1a4f54574e3d
children dc372251d4dc
files mercurial/stabletailgraph/stabletailsort.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/stabletailgraph/stabletailsort.py	Fri Apr 21 14:32:58 2023 +0200
+++ b/mercurial/stabletailgraph/stabletailsort.py	Mon May 22 19:04:05 2023 +0200
@@ -108,6 +108,9 @@
                 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