##// END OF EJS Templates
peer: build a `path` object on the fly when needed...
marmoute -
r50649:ec30fe69 default
parent child Browse files
Show More
@@ -244,19 +244,19 b' def repository('
244
244
245 def peer(uiorrepo, opts, path, create=False, intents=None, createopts=None):
245 def peer(uiorrepo, opts, path, create=False, intents=None, createopts=None):
246 '''return a repository peer for the specified path'''
246 '''return a repository peer for the specified path'''
247 ui = getattr(uiorrepo, 'ui', uiorrepo)
247 rui = remoteui(uiorrepo, opts)
248 rui = remoteui(uiorrepo, opts)
248 if util.safehasattr(path, 'url'):
249 if util.safehasattr(path, 'url'):
249 # this is a urlutil.path object
250 # this is already a urlutil.path object
250 scheme = path.url.scheme # pytype: disable=attribute-error
251 peer_path = path
251 # XXX for now we don't do anything more than that
252 path = path.loc # pytype: disable=attribute-error
253 else:
252 else:
254 scheme = urlutil.url(path).scheme
253 peer_path = urlutil.path(ui, None, rawloc=path, validate_path=False)
254 scheme = peer_path.url.scheme # pytype: disable=attribute-error
255 if scheme in peer_schemes:
255 if scheme in peer_schemes:
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 path,
259 peer_path.loc,
260 create,
260 create,
261 intents=intents,
261 intents=intents,
262 createopts=createopts,
262 createopts=createopts,
@@ -264,9 +264,12 b' def peer(uiorrepo, opts, path, create=Fa'
264 _setup_repo_or_peer(rui, peer)
264 _setup_repo_or_peer(rui, peer)
265 else:
265 else:
266 # this is a repository
266 # this is a repository
267 repo_path = peer_path.loc # pytype: disable=attribute-error
268 if not repo_path:
269 repo_path = peer_path.rawloc # pytype: disable=attribute-error
267 repo = repository(
270 repo = repository(
268 rui,
271 rui,
269 path,
272 repo_path,
270 create,
273 create,
271 intents=intents,
274 intents=intents,
272 createopts=createopts,
275 createopts=createopts,
General Comments 0
You need to be logged in to leave comments. Login now