comparison mercurial/hg.py @ 49707:aa36771ef505

path: have `peer` constructor accept a `path` object We don't do anything fancy with it yet, but this is an important step towards having the peers aware of their "source" and associated configurations.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 30 Nov 2022 19:43:26 +0100
parents 1470a533d28a
children e64b1e9f4892
comparison
equal deleted inserted replaced
49706:f27fbb908b10 49707:aa36771ef505
241 241
242 242
243 def peer(uiorrepo, opts, path, create=False, intents=None, createopts=None): 243 def peer(uiorrepo, opts, path, create=False, intents=None, createopts=None):
244 '''return a repository peer for the specified path''' 244 '''return a repository peer for the specified path'''
245 rui = remoteui(uiorrepo, opts) 245 rui = remoteui(uiorrepo, opts)
246 scheme = urlutil.url(path).scheme 246 if util.safehasattr(path, 'url'):
247 # this is a urlutil.path object
248 scheme = path.url.scheme # pytype: disable=attribute-error
249 # XXX for now we don't do anything more than that
250 path = path.loc # pytype: disable=attribute-error
251 else:
252 scheme = urlutil.url(path).scheme
247 if scheme in peer_schemes: 253 if scheme in peer_schemes:
248 cls = peer_schemes[scheme] 254 cls = peer_schemes[scheme]
249 peer = cls.instance( 255 peer = cls.instance(
250 rui, 256 rui,
251 path, 257 path,