Changeset View
Changeset View
Standalone View
Standalone View
mercurial/debugcommands.py
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | from . import ( | ||||
wireprotov2peer, | wireprotov2peer, | ||||
) | ) | ||||
from .utils import ( | from .utils import ( | ||||
cborutil, | cborutil, | ||||
compression, | compression, | ||||
dateutil, | dateutil, | ||||
procutil, | procutil, | ||||
stringutil, | stringutil, | ||||
urlutil, | |||||
) | ) | ||||
from .revlogutils import ( | from .revlogutils import ( | ||||
deltas as deltautil, | deltas as deltautil, | ||||
nodemap, | nodemap, | ||||
sidedata, | sidedata, | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 947 Lines • ▼ Show 20 Line(s) | def debugdiscovery(ui, repo, remoteurl=b"default", **opts): | ||||
# make sure tests are repeatable | # make sure tests are repeatable | ||||
random.seed(int(opts[b'seed'])) | random.seed(int(opts[b'seed'])) | ||||
if not remote_revs: | if not remote_revs: | ||||
remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl)) | remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl)) | ||||
remote = hg.peer(repo, opts, remoteurl) | remote = hg.peer(repo, opts, remoteurl) | ||||
ui.status(_(b'comparing with %s\n') % util.hidepassword(remoteurl)) | ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(remoteurl)) | ||||
else: | else: | ||||
branches = (None, []) | branches = (None, []) | ||||
remote_filtered_revs = scmutil.revrange( | remote_filtered_revs = scmutil.revrange( | ||||
unfi, [b"not (::(%s))" % remote_revs] | unfi, [b"not (::(%s))" % remote_revs] | ||||
) | ) | ||||
remote_filtered_revs = frozenset(remote_filtered_revs) | remote_filtered_revs = frozenset(remote_filtered_revs) | ||||
def remote_func(x): | def remote_func(x): | ||||
▲ Show 20 Lines • Show All 2574 Lines • ▼ Show 20 Line(s) | if not source: | ||||
_( | _( | ||||
b"there is no Mercurial repository here, and no " | b"there is no Mercurial repository here, and no " | ||||
b"server specified" | b"server specified" | ||||
) | ) | ||||
) | ) | ||||
source = b"default" | source = b"default" | ||||
source, branches = hg.parseurl(ui.expandpath(source)) | source, branches = hg.parseurl(ui.expandpath(source)) | ||||
url = util.url(source) | url = urlutil.url(source) | ||||
defaultport = {b'https': 443, b'ssh': 22} | defaultport = {b'https': 443, b'ssh': 22} | ||||
if url.scheme in defaultport: | if url.scheme in defaultport: | ||||
try: | try: | ||||
addr = (url.host, int(url.port or defaultport[url.scheme])) | addr = (url.host, int(url.port or defaultport[url.scheme])) | ||||
except ValueError: | except ValueError: | ||||
raise error.Abort(_(b"malformed port number in URL")) | raise error.Abort(_(b"malformed port number in URL")) | ||||
else: | else: | ||||
▲ Show 20 Lines • Show All 856 Lines • ▼ Show 20 Line(s) | if opts[b'localssh']: | ||||
stderr, | stderr, | ||||
autoreadstderr=autoreadstderr, | autoreadstderr=autoreadstderr, | ||||
) | ) | ||||
elif path: | elif path: | ||||
# We bypass hg.peer() so we can proxy the sockets. | # We bypass hg.peer() so we can proxy the sockets. | ||||
# TODO consider not doing this because we skip | # TODO consider not doing this because we skip | ||||
# ``hg.wirepeersetupfuncs`` and potentially other useful functionality. | # ``hg.wirepeersetupfuncs`` and potentially other useful functionality. | ||||
u = util.url(path) | u = urlutil.url(path) | ||||
if u.scheme != b'http': | if u.scheme != b'http': | ||||
raise error.Abort(_(b'only http:// paths are currently supported')) | raise error.Abort(_(b'only http:// paths are currently supported')) | ||||
url, authinfo = u.authinfo() | url, authinfo = u.authinfo() | ||||
openerargs = { | openerargs = { | ||||
'useragent': b'Mercurial debugwireproto', | 'useragent': b'Mercurial debugwireproto', | ||||
} | } | ||||
▲ Show 20 Lines • Show All 280 Lines • Show Last 20 Lines |