Mercurial > hg
changeset 50681:47b44d80d836
debug-revlog-stats: make it use the new store entry API
This give use free tree manifest support in the process.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 02 Jun 2023 15:12:05 +0200 |
parents | e324329fc97e |
children | 2cc5de261d76 |
files | mercurial/revlogutils/debug.py tests/test-debug-revlog-stats.t |
diffstat | 2 files changed, 11 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlogutils/debug.py Fri Jun 02 15:10:50 2023 +0200 +++ b/mercurial/revlogutils/debug.py Fri Jun 02 15:12:05 2023 +0200 @@ -663,27 +663,6 @@ deltacomputer.finddeltainfo(revinfo, fh, target_rev=rev) -def _get_revlogs(repo, changelog: bool, manifest: bool, filelogs: bool): - """yield revlogs from this repository""" - if changelog: - yield repo.changelog - - if manifest: - # XXX: Handle tree manifest - root_mf = repo.manifestlog.getstorage(b'') - assert not root_mf._treeondisk - yield root_mf._revlog - - if filelogs: - files = set() - for rev in repo: - ctx = repo[rev] - files |= set(ctx.files()) - - for f in sorted(files): - yield repo.file(f)._revlog - - def debug_revlog_stats( repo, fm, changelog: bool, manifest: bool, filelogs: bool ): @@ -693,7 +672,17 @@ """ fm.plain(b'rev-count data-size inl type target \n') - for rlog in _get_revlogs(repo, changelog, manifest, filelogs): + revlog_entries = [e for e in repo.store.walk() if e.is_revlog] + revlog_entries.sort(key=lambda e: (e.revlog_type, e.target_id)) + + for entry in revlog_entries: + if not changelog and entry.is_changelog: + continue + elif not manifest and entry.is_manifestlog: + continue + elif not filelogs and entry.is_filelog: + continue + rlog = entry.get_revlog_instance(repo).get_revlog() fm.startitem() nb_rev = len(rlog) inline = rlog._inline