##// END OF EJS Templates
peer: pass the `path` object to `make_peer`...
marmoute -
r50652:5f71fff8 default
parent child Browse files
Show More
@@ -80,13 +80,12 b' class ShortRepository:'
80 def __repr__(self):
80 def __repr__(self):
81 return b'<ShortRepository: %s>' % self.scheme
81 return b'<ShortRepository: %s>' % self.scheme
82
82
83 def make_peer(self, ui, url, *args, **kwargs):
83 def make_peer(self, ui, path, *args, **kwargs):
84 url = self.resolve(url)
84 new_url = self.resolve(path.rawloc)
85 u = urlutil.url(url)
85 path = path.copy(new_raw_location=new_url)
86 scheme = u.scheme or b'file'
86 cls = hg.peer_schemes.get(path.url.scheme)
87 cls = hg.peer_schemes.get(scheme)
88 if cls is not None:
87 if cls is not None:
89 return cls.make_peer(ui, url, *args, **kwargs)
88 return cls.make_peer(ui, path, *args, **kwargs)
90 return None
89 return None
91
90
92 def instance(self, ui, url, create, intents=None, createopts=None):
91 def instance(self, ui, url, create, intents=None, createopts=None):
@@ -256,7 +256,7 b' def peer(uiorrepo, opts, path, create=Fa'
256 cls = peer_schemes[scheme]
256 cls = peer_schemes[scheme]
257 peer = cls.make_peer(
257 peer = cls.make_peer(
258 rui,
258 rui,
259 peer_path.loc,
259 peer_path,
260 create,
260 create,
261 intents=intents,
261 intents=intents,
262 createopts=createopts,
262 createopts=createopts,
@@ -624,6 +624,7 b' def makepeer(ui, path, opener=None, requ'
624 def make_peer(ui, path, create, intents=None, createopts=None):
624 def make_peer(ui, path, create, intents=None, createopts=None):
625 if create:
625 if create:
626 raise error.Abort(_(b'cannot create new http repository'))
626 raise error.Abort(_(b'cannot create new http repository'))
627 path = path.loc
627 try:
628 try:
628 if path.startswith(b'https:') and not urlmod.has_https:
629 if path.startswith(b'https:') and not urlmod.has_https:
629 raise error.Abort(
630 raise error.Abort(
@@ -612,6 +612,7 b' def make_peer(ui, path, create, intents='
612
612
613 The returned object conforms to the ``wireprotov1peer.wirepeer`` interface.
613 The returned object conforms to the ``wireprotov1peer.wirepeer`` interface.
614 """
614 """
615 path = path.loc
615 u = urlutil.url(path, parsequery=False, parsefragment=False)
616 u = urlutil.url(path, parsequery=False, parsefragment=False)
616 if u.scheme != b'ssh' or not u.host or u.path is None:
617 if u.scheme != b'ssh' or not u.host or u.path is None:
617 raise error.RepoError(_(b"couldn't parse location %s") % path)
618 raise error.RepoError(_(b"couldn't parse location %s") % path)
@@ -262,4 +262,5 b' class statichttprepository('
262 def make_peer(ui, path, create, intents=None, createopts=None):
262 def make_peer(ui, path, create, intents=None, createopts=None):
263 if create:
263 if create:
264 raise error.Abort(_(b'cannot create new static-http repository'))
264 raise error.Abort(_(b'cannot create new static-http repository'))
265 path = path.loc
265 return statichttprepository(ui, path[7:]).peer()
266 return statichttprepository(ui, path[7:]).peer()
General Comments 0
You need to be logged in to leave comments. Login now