##// END OF EJS Templates
peer-or-repo: split the scheme between repo and peer...
marmoute -
r50584:f73f02ef default
parent child Browse files
Show More
@@ -136,7 +136,11 b' def extsetup(ui):'
136 136 )
137 137 % (scheme, scheme.upper())
138 138 )
139 hg.schemes[scheme] = ShortRepository(url, scheme, t)
139 url_scheme = urlutil.url(url).scheme
140 if url_scheme in hg.peer_schemes:
141 hg.peer_schemes[scheme] = ShortRepository(url, scheme, t)
142 else:
143 hg.repo_schemes[scheme] = ShortRepository(url, scheme, t)
140 144
141 145 extensions.wrapfunction(urlutil, b'hasdriveletter', hasdriveletter)
142 146
@@ -144,7 +148,11 b' def extsetup(ui):'
144 148 @command(b'debugexpandscheme', norepo=True)
145 149 def expandscheme(ui, url, **opts):
146 150 """given a repo path, provide the scheme-expanded path"""
147 repo = hg._peerlookup(url)
148 if isinstance(repo, ShortRepository):
149 url = repo.resolve(url)
151 scheme = urlutil.url(url).scheme
152 if scheme in hg.peer_schemes:
153 cls = hg.peer_schemes[scheme]
154 else:
155 cls = hg.repo_schemes.get(scheme)
156 if cls is not None and isinstance(cls, ShortRepository):
157 url = cls.resolve(url)
150 158 ui.write(url + b'\n')
@@ -143,22 +143,28 b' class LocalFactory:'
143 143 return cls.instance(ui, path, *args, **kwargs)
144 144
145 145
146 schemes = {
146 repo_schemes = {
147 147 b'bundle': bundlerepo,
148 148 b'union': unionrepo,
149 149 b'file': LocalFactory,
150 b'static-http': statichttprepo,
151 }
152
153 peer_schemes = {
150 154 b'http': httppeer,
151 155 b'https': httppeer,
152 156 b'ssh': sshpeer,
153 b'static-http': statichttprepo,
154 157 }
155 158
156 159
157 160 def _peerlookup(path):
158 161 u = urlutil.url(path)
159 162 scheme = u.scheme or b'file'
160 thing = schemes.get(scheme) or schemes[b'file']
161 return thing
163 if scheme in peer_schemes:
164 return peer_schemes[scheme]
165 if scheme in repo_schemes:
166 return repo_schemes[scheme]
167 return LocalFactory
162 168
163 169
164 170 def islocal(repo):
General Comments 0
You need to be logged in to leave comments. Login now