mercurial/debugcommands.py
changeset 50423 f0d2b18f0274
parent 50421 ed052780ad5e
child 50506 1b73868d17cf
--- a/mercurial/debugcommands.py	Wed Apr 05 16:09:08 2023 +0200
+++ b/mercurial/debugcommands.py	Thu Mar 30 22:22:44 2023 +0200
@@ -93,6 +93,7 @@
     wireprotoserver,
 )
 from .interfaces import repository
+from .stabletailgraph import stabletailsort
 from .utils import (
     cborutil,
     compression,
@@ -3644,6 +3645,30 @@
 
 
 @command(
+    b'debug::stable-tail-sort',
+    [
+        (
+            b'T',
+            b'template',
+            b'{rev}\n',
+            _(b'display with template'),
+            _(b'TEMPLATE'),
+        ),
+    ],
+    b'REV',
+)
+def debug_stable_tail_sort(ui, repo, revspec, template, **opts):
+    """display the stable-tail sort of the ancestors of a given node"""
+    rev = logcmdutil.revsingle(repo, revspec).rev()
+    cl = repo.changelog
+
+    displayer = logcmdutil.maketemplater(ui, repo, template)
+    sorted_revs = stabletailsort._stable_tail_sort(cl, rev)
+    for ancestor_rev in sorted_revs:
+        displayer.show(repo[ancestor_rev])
+
+
+@command(
     b"debugbackupbundle",
     [
         (