Mercurial > hg
changeset 49757:5f71fff8dc74
peer: pass the `path` object to `make_peer`
We don't do anything with it yet, but we can start implementing it for each peer
type starting now.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 02 Dec 2022 18:19:59 +0100 |
parents | d979c76d6e54 |
children | 20f262ab6fd3 |
files | hgext/schemes.py mercurial/hg.py mercurial/httppeer.py mercurial/sshpeer.py mercurial/statichttprepo.py |
diffstat | 5 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/schemes.py Fri Dec 02 18:18:57 2022 +0100 +++ b/hgext/schemes.py Fri Dec 02 18:19:59 2022 +0100 @@ -80,13 +80,12 @@ def __repr__(self): return b'<ShortRepository: %s>' % self.scheme - def make_peer(self, ui, url, *args, **kwargs): - url = self.resolve(url) - u = urlutil.url(url) - scheme = u.scheme or b'file' - cls = hg.peer_schemes.get(scheme) + def make_peer(self, ui, path, *args, **kwargs): + new_url = self.resolve(path.rawloc) + path = path.copy(new_raw_location=new_url) + cls = hg.peer_schemes.get(path.url.scheme) if cls is not None: - return cls.make_peer(ui, url, *args, **kwargs) + return cls.make_peer(ui, path, *args, **kwargs) return None def instance(self, ui, url, create, intents=None, createopts=None):
--- a/mercurial/hg.py Fri Dec 02 18:18:57 2022 +0100 +++ b/mercurial/hg.py Fri Dec 02 18:19:59 2022 +0100 @@ -256,7 +256,7 @@ cls = peer_schemes[scheme] peer = cls.make_peer( rui, - peer_path.loc, + peer_path, create, intents=intents, createopts=createopts,
--- a/mercurial/httppeer.py Fri Dec 02 18:18:57 2022 +0100 +++ b/mercurial/httppeer.py Fri Dec 02 18:19:59 2022 +0100 @@ -624,6 +624,7 @@ def make_peer(ui, path, create, intents=None, createopts=None): if create: raise error.Abort(_(b'cannot create new http repository')) + path = path.loc try: if path.startswith(b'https:') and not urlmod.has_https: raise error.Abort(
--- a/mercurial/sshpeer.py Fri Dec 02 18:18:57 2022 +0100 +++ b/mercurial/sshpeer.py Fri Dec 02 18:19:59 2022 +0100 @@ -612,6 +612,7 @@ The returned object conforms to the ``wireprotov1peer.wirepeer`` interface. """ + path = path.loc u = urlutil.url(path, parsequery=False, parsefragment=False) if u.scheme != b'ssh' or not u.host or u.path is None: raise error.RepoError(_(b"couldn't parse location %s") % path)
--- a/mercurial/statichttprepo.py Fri Dec 02 18:18:57 2022 +0100 +++ b/mercurial/statichttprepo.py Fri Dec 02 18:19:59 2022 +0100 @@ -262,4 +262,5 @@ def make_peer(ui, path, create, intents=None, createopts=None): if create: raise error.Abort(_(b'cannot create new static-http repository')) + path = path.loc return statichttprepository(ui, path[7:]).peer()