diff --git a/hgext/schemes.py b/hgext/schemes.py --- a/hgext/schemes.py +++ b/hgext/schemes.py @@ -82,7 +82,15 @@ class ShortRepository: def instance(self, ui, url, create, intents=None, createopts=None): url = self.resolve(url) - return hg._peerlookup(url).instance( + u = urlutil.url(url) + scheme = u.scheme or b'file' + if scheme in hg.peer_schemes: + cls = hg.peer_schemes[scheme] + elif scheme in hg.repo_schemes: + cls = hg.repo_schemes[scheme] + else: + cls = hg.LocalFactory + return cls.instance( ui, url, create, intents=intents, createopts=createopts ) diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -161,20 +161,17 @@ peer_schemes = { } -def _peerlookup(path): - u = urlutil.url(path) - scheme = u.scheme or b'file' - if scheme in peer_schemes: - return peer_schemes[scheme] - if scheme in repo_schemes: - return repo_schemes[scheme] - return LocalFactory - - def islocal(repo): '''return true if repo (or path pointing to repo) is local''' if isinstance(repo, bytes): - cls = _peerlookup(repo) + u = urlutil.url(repo) + scheme = u.scheme or b'file' + if scheme in peer_schemes: + cls = peer_schemes[scheme] + elif scheme in repo_schemes: + cls = repo_schemes[scheme] + else: + cls = LocalFactory cls.instance # make sure we load the module if util.safehasattr(cls, 'islocal'): return cls.islocal(repo) # pytype: disable=module-attr