# HG changeset patch # User Pierre-Yves David # Date 1670001599 -3600 # Node ID 5f71fff8dc74c83347d422ca01e60cb336a3937d # Parent d979c76d6e542dd058de6a47ce39cb2aac979d41 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. diff -r d979c76d6e54 -r 5f71fff8dc74 hgext/schemes.py --- 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'' % 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): diff -r d979c76d6e54 -r 5f71fff8dc74 mercurial/hg.py --- 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, diff -r d979c76d6e54 -r 5f71fff8dc74 mercurial/httppeer.py --- 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( diff -r d979c76d6e54 -r 5f71fff8dc74 mercurial/sshpeer.py --- 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) diff -r d979c76d6e54 -r 5f71fff8dc74 mercurial/statichttprepo.py --- 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()