comparison mercurial/debugcommands.py @ 46907:ffd3e823a7e5

urlutil: extract `url` related code from `util` into the new module The new module is well fitting for this new code. And this will be useful to make the gathered code collaborate more later. Differential Revision: https://phab.mercurial-scm.org/D10374
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 12 Apr 2021 03:01:04 +0200
parents d4ba4d51f85f
children 4452cb788404
comparison
equal deleted inserted replaced
46906:33524c46a092 46907:ffd3e823a7e5
96 cborutil, 96 cborutil,
97 compression, 97 compression,
98 dateutil, 98 dateutil,
99 procutil, 99 procutil,
100 stringutil, 100 stringutil,
101 urlutil,
101 ) 102 )
102 103
103 from .revlogutils import ( 104 from .revlogutils import (
104 deltas as deltautil, 105 deltas as deltautil,
105 nodemap, 106 nodemap,
1059 1060
1060 if not remote_revs: 1061 if not remote_revs:
1061 1062
1062 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl)) 1063 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl))
1063 remote = hg.peer(repo, opts, remoteurl) 1064 remote = hg.peer(repo, opts, remoteurl)
1064 ui.status(_(b'comparing with %s\n') % util.hidepassword(remoteurl)) 1065 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(remoteurl))
1065 else: 1066 else:
1066 branches = (None, []) 1067 branches = (None, [])
1067 remote_filtered_revs = scmutil.revrange( 1068 remote_filtered_revs = scmutil.revrange(
1068 unfi, [b"not (::(%s))" % remote_revs] 1069 unfi, [b"not (::(%s))" % remote_revs]
1069 ) 1070 )
3650 ) 3651 )
3651 ) 3652 )
3652 source = b"default" 3653 source = b"default"
3653 3654
3654 source, branches = hg.parseurl(ui.expandpath(source)) 3655 source, branches = hg.parseurl(ui.expandpath(source))
3655 url = util.url(source) 3656 url = urlutil.url(source)
3656 3657
3657 defaultport = {b'https': 443, b'ssh': 22} 3658 defaultport = {b'https': 443, b'ssh': 22}
3658 if url.scheme in defaultport: 3659 if url.scheme in defaultport:
3659 try: 3660 try:
3660 addr = (url.host, int(url.port or defaultport[url.scheme])) 3661 addr = (url.host, int(url.port or defaultport[url.scheme]))
4523 4524
4524 elif path: 4525 elif path:
4525 # We bypass hg.peer() so we can proxy the sockets. 4526 # We bypass hg.peer() so we can proxy the sockets.
4526 # TODO consider not doing this because we skip 4527 # TODO consider not doing this because we skip
4527 # ``hg.wirepeersetupfuncs`` and potentially other useful functionality. 4528 # ``hg.wirepeersetupfuncs`` and potentially other useful functionality.
4528 u = util.url(path) 4529 u = urlutil.url(path)
4529 if u.scheme != b'http': 4530 if u.scheme != b'http':
4530 raise error.Abort(_(b'only http:// paths are currently supported')) 4531 raise error.Abort(_(b'only http:// paths are currently supported'))
4531 4532
4532 url, authinfo = u.authinfo() 4533 url, authinfo = u.authinfo()
4533 openerargs = { 4534 openerargs = {