Mercurial > hg
changeset 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 | ba4072c0a911 |
children | 03e769278ef3 |
files | mercurial/debugcommands.py tests/test-completion.t tests/test-help.t tests/test-sidedata.t |
diffstat | 4 files changed, 48 insertions(+), 0 deletions(-) [+] |
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
--- a/tests/test-completion.t Mon Sep 09 21:38:29 2019 +0200 +++ b/tests/test-completion.t Tue Sep 10 00:15:47 2019 +0200 @@ -124,6 +124,7 @@ debugrevspec debugserve debugsetparents + debugsidedata debugssl debugsub debugsuccessorssets @@ -305,6 +306,7 @@ debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, verify-optimized debugserve: sshstdio, logiofd, logiofile debugsetparents: + debugsidedata: changelog, manifest, dir debugssl: debugsub: rev debugsuccessorssets: closest
--- a/tests/test-help.t Mon Sep 09 21:38:29 2019 +0200 +++ b/tests/test-help.t Tue Sep 10 00:15:47 2019 +0200 @@ -1048,6 +1048,8 @@ debugserve run a server with advanced settings debugsetparents manually set the parents of the current working directory + debugsidedata + dump the side data for a cl/manifest/file revision debugssl test a secure connection to a server debugsub (no help text available) debugsuccessorssets
--- a/tests/test-sidedata.t Mon Sep 09 21:38:29 2019 +0200 +++ b/tests/test-sidedata.t Tue Sep 10 00:15:47 2019 +0200 @@ -21,6 +21,25 @@ $ echo xxx >> a $ hg commit -m aa + $ hg debugsidedata -c 0 + 2 sidedata entries + entry-0001 size 4 + entry-0002 size 32 + $ hg debugsidedata -c 1 -v + 2 sidedata entries + entry-0001 size 4 + '\x00\x00\x006' + entry-0002 size 32 + '\x98\t\xf9\xc4v\xf0\xc5P\x90\xf7wRf\xe8\xe27e\xfc\xc1\x93\xa4\x96\xd0\x1d\x97\xaaG\x1d\xd7t\xfa\xde' + $ hg debugsidedata -m 2 + 2 sidedata entries + entry-0001 size 4 + entry-0002 size 32 + $ hg debugsidedata a 1 + 2 sidedata entries + entry-0001 size 4 + entry-0002 size 32 + Check upgrade behavior ======================