diff mercurial/debugcommands.py @ 50562:8fb3e942473a

stabletailgraph: naive version of leap computation This adds a naive reference implementation of the computation of leap and specific leap sets (described in the code documentation). The existing tests are enriched accordingly.
author pacien <pacien.trangirard@pacien.net>
date Fri, 21 Apr 2023 14:33:33 +0200
parents 1a4f54574e3d
children 2f5270af57c7
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Fri Apr 21 16:19:32 2023 +0200
+++ b/mercurial/debugcommands.py	Fri Apr 21 14:33:33 2023 +0200
@@ -3677,6 +3677,36 @@
 
 
 @command(
+    b'debug::stable-tail-sort-leaps',
+    [
+        (
+            b'T',
+            b'template',
+            b'{rev}',
+            _(b'display with template'),
+            _(b'TEMPLATE'),
+        ),
+        (b's', b'specific', False, _(b'restrict to specific leaps')),
+    ],
+    b'REV',
+)
+def debug_stable_tail_sort_leaps(ui, repo, rspec, template, specific, **opts):
+    """display the leaps in the stable-tail sort of a node, one per line"""
+    rev = logcmdutil.revsingle(repo, rspec).rev()
+
+    if specific:
+        get_leaps = stabletailsort._find_specific_leaps_naive
+    else:
+        get_leaps = stabletailsort._find_all_leaps_naive
+
+    displayer = logcmdutil.maketemplater(ui, repo, template)
+    for source, target in get_leaps(repo.changelog, rev):
+        displayer.show(repo[source])
+        displayer.show(repo[target])
+        ui.write(b'\n')
+
+
+@command(
     b"debugbackupbundle",
     [
         (