diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -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 diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -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 diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -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 diff --git a/tests/test-sidedata.t b/tests/test-sidedata.t --- a/tests/test-sidedata.t +++ b/tests/test-sidedata.t @@ -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 ======================