comparison hgext/schemes.py @ 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 f075a9463ee7
children bcc45b33efb2
comparison
equal deleted inserted replaced
49756:d979c76d6e54 49757:5f71fff8dc74
78 self.parts = 0 78 self.parts = 0
79 79
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):
93 url = self.resolve(url) 92 url = self.resolve(url)
94 u = urlutil.url(url) 93 u = urlutil.url(url)