##// END OF EJS Templates
peer: dissolve `_peerlookup` into its last two callers...
marmoute -
r50644:be3fcd9e default
parent child Browse files
Show More
@@ -82,7 +82,15 b' class ShortRepository:'
82 82
83 83 def instance(self, ui, url, create, intents=None, createopts=None):
84 84 url = self.resolve(url)
85 return hg._peerlookup(url).instance(
85 u = urlutil.url(url)
86 scheme = u.scheme or b'file'
87 if scheme in hg.peer_schemes:
88 cls = hg.peer_schemes[scheme]
89 elif scheme in hg.repo_schemes:
90 cls = hg.repo_schemes[scheme]
91 else:
92 cls = hg.LocalFactory
93 return cls.instance(
86 94 ui, url, create, intents=intents, createopts=createopts
87 95 )
88 96
@@ -161,20 +161,17 b' peer_schemes = {'
161 161 }
162 162
163 163
164 def _peerlookup(path):
165 u = urlutil.url(path)
166 scheme = u.scheme or b'file'
167 if scheme in peer_schemes:
168 return peer_schemes[scheme]
169 if scheme in repo_schemes:
170 return repo_schemes[scheme]
171 return LocalFactory
172
173
174 164 def islocal(repo):
175 165 '''return true if repo (or path pointing to repo) is local'''
176 166 if isinstance(repo, bytes):
177 cls = _peerlookup(repo)
167 u = urlutil.url(repo)
168 scheme = u.scheme or b'file'
169 if scheme in peer_schemes:
170 cls = peer_schemes[scheme]
171 elif scheme in repo_schemes:
172 cls = repo_schemes[scheme]
173 else:
174 cls = LocalFactory
178 175 cls.instance # make sure we load the module
179 176 if util.safehasattr(cls, 'islocal'):
180 177 return cls.islocal(repo) # pytype: disable=module-attr
General Comments 0
You need to be logged in to leave comments. Login now