diff mercurial/hg.py @ 49801:f73f02ef8cb6

peer-or-repo: split the scheme between repo and peer Some of the scheme will always produce a peer and some will always produce a repository. So lets use different mapping to reduce the ambiguity.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 29 Nov 2022 21:48:08 +0100
parents 0d5b2e010614
children c37287340c00
line wrap: on
line diff
--- a/mercurial/hg.py	Wed Nov 30 13:55:15 2022 +0100
+++ b/mercurial/hg.py	Tue Nov 29 21:48:08 2022 +0100
@@ -143,22 +143,28 @@
         return cls.instance(ui, path, *args, **kwargs)
 
 
-schemes = {
+repo_schemes = {
     b'bundle': bundlerepo,
     b'union': unionrepo,
     b'file': LocalFactory,
+    b'static-http': statichttprepo,
+}
+
+peer_schemes = {
     b'http': httppeer,
     b'https': httppeer,
     b'ssh': sshpeer,
-    b'static-http': statichttprepo,
 }
 
 
 def _peerlookup(path):
     u = urlutil.url(path)
     scheme = u.scheme or b'file'
-    thing = schemes.get(scheme) or schemes[b'file']
-    return thing
+    if scheme in peer_schemes:
+        return peer_schemes[scheme]
+    if scheme in repo_schemes:
+        return repo_schemes[scheme]
+    return LocalFactory
 
 
 def islocal(repo):