Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/sshpeer.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 | 04688c51f81f |
comparison
equal
deleted
inserted
replaced
46906:33524c46a092 | 46907:ffd3e823a7e5 |
---|---|
22 wireprotov1server, | 22 wireprotov1server, |
23 ) | 23 ) |
24 from .utils import ( | 24 from .utils import ( |
25 procutil, | 25 procutil, |
26 stringutil, | 26 stringutil, |
27 urlutil, | |
27 ) | 28 ) |
28 | 29 |
29 | 30 |
30 def _serverquote(s): | 31 def _serverquote(s): |
31 """quote a string for the remote shell ... which we assume is sh""" | 32 """quote a string for the remote shell ... which we assume is sh""" |
660 def instance(ui, path, create, intents=None, createopts=None): | 661 def instance(ui, path, create, intents=None, createopts=None): |
661 """Create an SSH peer. | 662 """Create an SSH peer. |
662 | 663 |
663 The returned object conforms to the ``wireprotov1peer.wirepeer`` interface. | 664 The returned object conforms to the ``wireprotov1peer.wirepeer`` interface. |
664 """ | 665 """ |
665 u = util.url(path, parsequery=False, parsefragment=False) | 666 u = urlutil.url(path, parsequery=False, parsefragment=False) |
666 if u.scheme != b'ssh' or not u.host or u.path is None: | 667 if u.scheme != b'ssh' or not u.host or u.path is None: |
667 raise error.RepoError(_(b"couldn't parse location %s") % path) | 668 raise error.RepoError(_(b"couldn't parse location %s") % path) |
668 | 669 |
669 util.checksafessh(path) | 670 urlutil.checksafessh(path) |
670 | 671 |
671 if u.passwd is not None: | 672 if u.passwd is not None: |
672 raise error.RepoError(_(b'password in URL not supported')) | 673 raise error.RepoError(_(b'password in URL not supported')) |
673 | 674 |
674 sshcmd = ui.config(b'ui', b'ssh') | 675 sshcmd = ui.config(b'ui', b'ssh') |