diff mercurial/hg.py @ 49861: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 78af51ba73c5
children f075a9463ee7
line wrap: on
line diff
--- a/mercurial/hg.py	Sat Dec 03 03:45:45 2022 +0100
+++ b/mercurial/hg.py	Fri Dec 02 18:04:37 2022 +0100
@@ -161,20 +161,17 @@
 }
 
 
-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