Mercurial > public > mercurial-scm > hg-stable
diff mercurial/debugcommands.py @ 43041:559ac8411f12
sidedata: add a debugsidedata command
The command provide basic capabilities to inspect revision side data.
Differential Revision: https://phab.mercurial-scm.org/D6897
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 10 Sep 2019 00:15:47 +0200 |
parents | 34ed651ba7e4 |
children | 0fde7d47ad6f |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Mon Sep 09 21:38:29 2019 +0200 +++ b/mercurial/debugcommands.py Tue Sep 10 00:15:47 2019 +0200 @@ -2640,6 +2640,31 @@ with repo.wlock(): repo.setparents(node1, node2) +@command('debugsidedata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV')) +def debugsidedata(ui, repo, file_, rev=None, **opts): + """dump the side data for a cl/manifest/file revision""" + opts = pycompat.byteskwargs(opts) + if opts.get('changelog') or opts.get('manifest') or opts.get('dir'): + if rev is not None: + raise error.CommandError('debugdata', _('invalid arguments')) + file_, rev = None, file_ + elif rev is None: + raise error.CommandError('debugdata', _('invalid arguments')) + r = cmdutil.openstorage(repo, 'debugdata', file_, opts) + r = getattr(r, '_revlog', r) + try: + sidedata = r.sidedata(r.lookup(rev)) + except KeyError: + raise error.Abort(_('invalid revision identifier %s') % rev) + if sidedata: + sidedata = list(sidedata.items()) + sidedata.sort() + ui.write(('%d sidedata entries\n' % len(sidedata))) + for key, value in sidedata: + ui.write((' entry-%04o size %d\n' % (key, len(value)))) + if ui.verbose: + ui.write((' %s\n' % repr(value))) + @command('debugssl', [], '[SOURCE]', optionalrepo=True) def debugssl(ui, repo, source=None, **opts): '''test a secure connection to a server