diff --git a/hgext/schemes.py b/hgext/schemes.py --- a/hgext/schemes.py +++ b/hgext/schemes.py @@ -80,13 +80,12 @@ class ShortRepository: 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 --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -256,7 +256,7 @@ def peer(uiorrepo, opts, path, create=Fa cls = peer_schemes[scheme] peer = cls.make_peer( rui, - peer_path.loc, + peer_path, create, intents=intents, createopts=createopts, diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -624,6 +624,7 @@ def makepeer(ui, path, opener=None, requ 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 --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py --- a/mercurial/sshpeer.py +++ b/mercurial/sshpeer.py @@ -612,6 +612,7 @@ def make_peer(ui, path, create, intents= 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 --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py --- a/mercurial/statichttprepo.py +++ b/mercurial/statichttprepo.py @@ -262,4 +262,5 @@ class statichttprepository( 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()