diff hgext/schemes.py @ 49749:be3fcd9e5e52

peer: dissolve `_peerlookup` into its last two callers This is about to need more changes and the function won't be useful. We do it early to clarify later changes.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 02 Dec 2022 18:04:37 +0100
parents 1863584f2fba
children f075a9463ee7
line wrap: on
line diff
--- a/hgext/schemes.py	Sat Dec 03 03:45:45 2022 +0100
+++ b/hgext/schemes.py	Fri Dec 02 18:04:37 2022 +0100
@@ -82,7 +82,15 @@
 
     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
         )