Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 51077:810446d2d5ef
debug-delta-chaing: add a parameter to select revision to look at
This allows for much faster runtime when we are interrested in some revisions only.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 19 Sep 2023 01:24:10 +0200 |
parents | d7f975e49f20 |
children | 752e380c5702 |
comparison
equal
deleted
inserted
replaced
51076:793a058f64bd | 51077:810446d2d5ef |
---|---|
744 ui.writenoi18n(b"match: %s\n" % m(d[0])) | 744 ui.writenoi18n(b"match: %s\n" % m(d[0])) |
745 | 745 |
746 | 746 |
747 @command( | 747 @command( |
748 b'debugdeltachain', | 748 b'debugdeltachain', |
749 cmdutil.debugrevlogopts + cmdutil.formatteropts, | 749 [ |
750 ( | |
751 b'r', | |
752 b'rev', | |
753 [], | |
754 _('restrict processing to these revlog revisions'), | |
755 ), | |
756 ] | |
757 + cmdutil.debugrevlogopts | |
758 + cmdutil.formatteropts, | |
750 _(b'-c|-m|FILE'), | 759 _(b'-c|-m|FILE'), |
751 optionalrepo=True, | 760 optionalrepo=True, |
752 ) | 761 ) |
753 def debugdeltachain(ui, repo, file_=None, **opts): | 762 def debugdeltachain(ui, repo, file_=None, **opts): |
754 """dump information about delta chains in a revlog | 763 """dump information about delta chains in a revlog |
795 :``readdensity``: density of useful bytes in the data read from the disk | 804 :``readdensity``: density of useful bytes in the data read from the disk |
796 :``srchunks``: in how many data hunks the whole revision would be read | 805 :``srchunks``: in how many data hunks the whole revision would be read |
797 | 806 |
798 The sparse read can be enabled with experimental.sparse-read = True | 807 The sparse read can be enabled with experimental.sparse-read = True |
799 """ | 808 """ |
809 revs = None | |
810 revs_opt = opts.pop('rev', []) | |
811 if revs_opt: | |
812 revs = [int(r) for r in revs_opt] | |
800 revlog = cmdutil.openrevlog( | 813 revlog = cmdutil.openrevlog( |
801 repo, b'debugdeltachain', file_, pycompat.byteskwargs(opts) | 814 repo, b'debugdeltachain', file_, pycompat.byteskwargs(opts) |
802 ) | 815 ) |
803 fm = ui.formatter(b'debugdeltachain', pycompat.byteskwargs(opts)) | 816 fm = ui.formatter(b'debugdeltachain', pycompat.byteskwargs(opts)) |
804 | 817 |
805 lines = revlog_debug.debug_delta_chain(revlog) | 818 lines = revlog_debug.debug_delta_chain(revlog, revs=revs) |
806 # first entry is the header | 819 # first entry is the header |
807 header = next(lines) | 820 header = next(lines) |
808 fm.plain(header) | 821 fm.plain(header) |
809 for entry in lines: | 822 for entry in lines: |
810 label = b' '.join(e[0] for e in entry) | 823 label = b' '.join(e[0] for e in entry) |