# HG changeset patch # User Pierre-Yves David # Date 1669833806 -3600 # Node ID aa36771ef50539e0045af6be92dd6d3dc6521e0d # Parent f27fbb908b10440f4c47144dfdbb590e4da212ad 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. diff -r f27fbb908b10 -r aa36771ef505 mercurial/hg.py --- a/mercurial/hg.py Thu Dec 01 01:46:46 2022 +0100 +++ b/mercurial/hg.py Wed Nov 30 19:43:26 2022 +0100 @@ -243,7 +243,13 @@ def peer(uiorrepo, opts, path, create=False, intents=None, createopts=None): '''return a repository peer for the specified path''' rui = remoteui(uiorrepo, opts) - scheme = urlutil.url(path).scheme + if util.safehasattr(path, 'url'): + # this is a urlutil.path object + scheme = path.url.scheme # pytype: disable=attribute-error + # XXX for now we don't do anything more than that + path = path.loc # pytype: disable=attribute-error + else: + scheme = urlutil.url(path).scheme if scheme in peer_schemes: cls = peer_schemes[scheme] peer = cls.instance(