comparison mercurial/debugcommands.py @ 50528: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
comparison
equal deleted inserted replaced
50527:dc372251d4dc 50528:8fb3e942473a
3675 for ancestor_rev in sorted_revs: 3675 for ancestor_rev in sorted_revs:
3676 displayer.show(repo[ancestor_rev]) 3676 displayer.show(repo[ancestor_rev])
3677 3677
3678 3678
3679 @command( 3679 @command(
3680 b'debug::stable-tail-sort-leaps',
3681 [
3682 (
3683 b'T',
3684 b'template',
3685 b'{rev}',
3686 _(b'display with template'),
3687 _(b'TEMPLATE'),
3688 ),
3689 (b's', b'specific', False, _(b'restrict to specific leaps')),
3690 ],
3691 b'REV',
3692 )
3693 def debug_stable_tail_sort_leaps(ui, repo, rspec, template, specific, **opts):
3694 """display the leaps in the stable-tail sort of a node, one per line"""
3695 rev = logcmdutil.revsingle(repo, rspec).rev()
3696
3697 if specific:
3698 get_leaps = stabletailsort._find_specific_leaps_naive
3699 else:
3700 get_leaps = stabletailsort._find_all_leaps_naive
3701
3702 displayer = logcmdutil.maketemplater(ui, repo, template)
3703 for source, target in get_leaps(repo.changelog, rev):
3704 displayer.show(repo[source])
3705 displayer.show(repo[target])
3706 ui.write(b'\n')
3707
3708
3709 @command(
3680 b"debugbackupbundle", 3710 b"debugbackupbundle",
3681 [ 3711 [
3682 ( 3712 (
3683 b"", 3713 b"",
3684 b"recover", 3714 b"recover",