# HG changeset patch # User Pierre-Yves David # Date 1669756879 -3600 # Node ID ebb5e38fdafc7a8e3f012b48b9d8db5a9789280c # Parent c0acf5440fe1b4e2150b8f6ce3cbdf721d40693b peer-or-repo: build a repo directly in the `repo` function We skip the ambiguous _peerorrepo function to explicitly build a repo within the dedicated function. The peer scheme are therefore no longer considered to build the object. diff -r c0acf5440fe1 -r ebb5e38fdafc mercurial/hg.py --- a/mercurial/hg.py Tue Nov 29 22:04:23 2022 +0100 +++ b/mercurial/hg.py Tue Nov 29 22:21:19 2022 +0100 @@ -231,19 +231,22 @@ createopts=None, ): """return a repository object for the specified path""" - peer = _peerorrepo( + scheme = urlutil.url(path).scheme + if scheme is None: + scheme = b'file' + cls = repo_schemes.get(scheme) + if cls is None: + if scheme in peer_schemes: + raise error.Abort(_(b"repository '%s' is not local") % path) + cls = LocalFactory + repo = cls.instance( ui, path, create, - presetupfuncs=presetupfuncs, intents=intents, createopts=createopts, ) - repo = peer.local() - if not repo: - raise error.Abort( - _(b"repository '%s' is not local") % (path or peer.url()) - ) + _setup_repo_or_peer(ui, repo, presetupfuncs=presetupfuncs) return repo.filtered(b'visible')