comparison 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
comparison
equal deleted inserted replaced
43040:ba4072c0a911 43041:559ac8411f12
2638 node2 = scmutil.revsingle(repo, rev2, 'null').node() 2638 node2 = scmutil.revsingle(repo, rev2, 'null').node()
2639 2639
2640 with repo.wlock(): 2640 with repo.wlock():
2641 repo.setparents(node1, node2) 2641 repo.setparents(node1, node2)
2642 2642
2643 @command('debugsidedata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
2644 def debugsidedata(ui, repo, file_, rev=None, **opts):
2645 """dump the side data for a cl/manifest/file revision"""
2646 opts = pycompat.byteskwargs(opts)
2647 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
2648 if rev is not None:
2649 raise error.CommandError('debugdata', _('invalid arguments'))
2650 file_, rev = None, file_
2651 elif rev is None:
2652 raise error.CommandError('debugdata', _('invalid arguments'))
2653 r = cmdutil.openstorage(repo, 'debugdata', file_, opts)
2654 r = getattr(r, '_revlog', r)
2655 try:
2656 sidedata = r.sidedata(r.lookup(rev))
2657 except KeyError:
2658 raise error.Abort(_('invalid revision identifier %s') % rev)
2659 if sidedata:
2660 sidedata = list(sidedata.items())
2661 sidedata.sort()
2662 ui.write(('%d sidedata entries\n' % len(sidedata)))
2663 for key, value in sidedata:
2664 ui.write((' entry-%04o size %d\n' % (key, len(value))))
2665 if ui.verbose:
2666 ui.write((' %s\n' % repr(value)))
2667
2643 @command('debugssl', [], '[SOURCE]', optionalrepo=True) 2668 @command('debugssl', [], '[SOURCE]', optionalrepo=True)
2644 def debugssl(ui, repo, source=None, **opts): 2669 def debugssl(ui, repo, source=None, **opts):
2645 '''test a secure connection to a server 2670 '''test a secure connection to a server
2646 2671
2647 This builds the certificate chain for the server on Windows, installing the 2672 This builds the certificate chain for the server on Windows, installing the