comparison mercurial/debugcommands.py @ 35929:5f029d03cf71

debugcommands: introduce debugpeer command `hg debugpeer <path>` will establish a connection to a peer repository and print information about it. If you add --debug, it will log low-level protocol request info. This will be useful for upcoming tests around protocol handshaking. Differential Revision: https://phab.mercurial-scm.org/D2025
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 03 Feb 2018 12:01:01 -0800
parents 2da4144e6716
children 8eb13f5d5d3f
comparison
equal deleted inserted replaced
35928:b0d2885c5945 35929:5f029d03cf71
1691 dirs.update(d) 1691 dirs.update(d)
1692 files.update(dirs) 1692 files.update(dirs)
1693 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files))) 1693 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1694 ui.write('\n') 1694 ui.write('\n')
1695 1695
1696 @command('debugpeer', [], _('PATH'), norepo=True)
1697 def debugpeer(ui, path):
1698 """establish a connection to a peer repository"""
1699 # Always enable peer request logging. Requires --debug to display
1700 # though.
1701 overrides = {
1702 ('devel', 'debug.peer-request'): True,
1703 }
1704
1705 with ui.configoverride(overrides):
1706 peer = hg.peer(ui, {}, path)
1707
1708 local = peer.local() is not None
1709 canpush = peer.canpush()
1710
1711 ui.write(_('url: %s\n') % peer.url())
1712 ui.write(_('local: %s\n') % (_('yes') if local else _('no')))
1713 ui.write(_('pushable: %s\n') % (_('yes') if canpush else _('no')))
1714
1696 @command('debugpickmergetool', 1715 @command('debugpickmergetool',
1697 [('r', 'rev', '', _('check for files in this revision'), _('REV')), 1716 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1698 ('', 'changedelete', None, _('emulate merging change and delete')), 1717 ('', 'changedelete', None, _('emulate merging change and delete')),
1699 ] + cmdutil.walkopts + cmdutil.mergetoolopts, 1718 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1700 _('[PATTERN]...'), 1719 _('[PATTERN]...'),