Mercurial > public > mercurial-scm > hg-stable
diff mercurial/debugcommands.py @ 50460:f0d2b18f0274
stabletailgraph: implement stable-tail sort
This adds the computation of the "stable-tail sort", an incremental node
sorting method. It is a stepping stone for the implementation of faster
label discovery (for example for obs markers) and more caching.
author | pacien <pacien.trangirard@pacien.net> |
---|---|
date | Thu, 30 Mar 2023 22:22:44 +0200 |
parents | ed052780ad5e |
children | 1b73868d17cf |
line wrap: on
line diff
--- 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", [ (