comparison mercurial/debugcommands.py @ 49819:b1e4c74beb6f

debug: add debug-revlog-stats command Display statistics about revlogs in the store. Useful to get an approximate size of a repository, etc. More statistics will be added in the future.
author Franck Bret <franck.bret@octobus.net>
date Mon, 19 Dec 2022 16:22:01 +0100
parents cfe8d88a453e
children fdd227585d5a
comparison
equal deleted inserted replaced
49818:3fd5824f1177 49819:b1e4c74beb6f
3807 3807
3808 code.interact(local=imported_objects) 3808 code.interact(local=imported_objects)
3809 3809
3810 3810
3811 @command( 3811 @command(
3812 b'debug-revlog-stats',
3813 [
3814 (b'c', b'changelog', None, _(b'Display changelog statistics')),
3815 (b'm', b'manifest', None, _(b'Display manifest statistics')),
3816 (b'f', b'filelogs', None, _(b'Display filelogs statistics')),
3817 ]
3818 + cmdutil.formatteropts,
3819 )
3820 def debug_revlog_stats(ui, repo, **opts):
3821 """display statistics about revlogs in the store"""
3822 opts = pycompat.byteskwargs(opts)
3823 changelog = opts[b"changelog"]
3824 manifest = opts[b"manifest"]
3825 filelogs = opts[b"filelogs"]
3826
3827 if changelog is None and manifest is None and filelogs is None:
3828 changelog = True
3829 manifest = True
3830 filelogs = True
3831
3832 repo = repo.unfiltered()
3833 fm = ui.formatter(b'debug-revlog-stats', opts)
3834 revlog_debug.debug_revlog_stats(repo, fm, changelog, manifest, filelogs)
3835 fm.end()
3836
3837
3838 @command(
3812 b'debugsuccessorssets', 3839 b'debugsuccessorssets',
3813 [(b'', b'closest', False, _(b'return closest successors sets only'))], 3840 [(b'', b'closest', False, _(b'return closest successors sets only'))],
3814 _(b'[REV]'), 3841 _(b'[REV]'),
3815 ) 3842 )
3816 def debugsuccessorssets(ui, repo, *revs, **opts): 3843 def debugsuccessorssets(ui, repo, *revs, **opts):