Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
50459:9fa3cda7449e | 50460:f0d2b18f0274 |
---|---|
91 vfs as vfsmod, | 91 vfs as vfsmod, |
92 wireprotoframing, | 92 wireprotoframing, |
93 wireprotoserver, | 93 wireprotoserver, |
94 ) | 94 ) |
95 from .interfaces import repository | 95 from .interfaces import repository |
96 from .stabletailgraph import stabletailsort | |
96 from .utils import ( | 97 from .utils import ( |
97 cborutil, | 98 cborutil, |
98 compression, | 99 compression, |
99 dateutil, | 100 dateutil, |
100 procutil, | 101 procutil, |
3642 finally: | 3643 finally: |
3643 s.close() | 3644 s.close() |
3644 | 3645 |
3645 | 3646 |
3646 @command( | 3647 @command( |
3648 b'debug::stable-tail-sort', | |
3649 [ | |
3650 ( | |
3651 b'T', | |
3652 b'template', | |
3653 b'{rev}\n', | |
3654 _(b'display with template'), | |
3655 _(b'TEMPLATE'), | |
3656 ), | |
3657 ], | |
3658 b'REV', | |
3659 ) | |
3660 def debug_stable_tail_sort(ui, repo, revspec, template, **opts): | |
3661 """display the stable-tail sort of the ancestors of a given node""" | |
3662 rev = logcmdutil.revsingle(repo, revspec).rev() | |
3663 cl = repo.changelog | |
3664 | |
3665 displayer = logcmdutil.maketemplater(ui, repo, template) | |
3666 sorted_revs = stabletailsort._stable_tail_sort(cl, rev) | |
3667 for ancestor_rev in sorted_revs: | |
3668 displayer.show(repo[ancestor_rev]) | |
3669 | |
3670 | |
3671 @command( | |
3647 b"debugbackupbundle", | 3672 b"debugbackupbundle", |
3648 [ | 3673 [ |
3649 ( | 3674 ( |
3650 b"", | 3675 b"", |
3651 b"recover", | 3676 b"recover", |