##// 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 % (scheme, scheme.upper())
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 extensions.wrapfunction(urlutil, b'hasdriveletter', hasdriveletter)
145 extensions.wrapfunction(urlutil, b'hasdriveletter', hasdriveletter)
142
146
@@ -144,7 +148,11 b' def extsetup(ui):'
144 @command(b'debugexpandscheme', norepo=True)
148 @command(b'debugexpandscheme', norepo=True)
145 def expandscheme(ui, url, **opts):
149 def expandscheme(ui, url, **opts):
146 """given a repo path, provide the scheme-expanded path"""
150 """given a repo path, provide the scheme-expanded path"""
147 repo = hg._peerlookup(url)
151 scheme = urlutil.url(url).scheme
148 if isinstance(repo, ShortRepository):
152 if scheme in hg.peer_schemes:
149 url = repo.resolve(url)
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 ui.write(url + b'\n')
158 ui.write(url + b'\n')
@@ -143,22 +143,28 b' class LocalFactory:'
143 return cls.instance(ui, path, *args, **kwargs)
143 return cls.instance(ui, path, *args, **kwargs)
144
144
145
145
146 schemes = {
146 repo_schemes = {
147 b'bundle': bundlerepo,
147 b'bundle': bundlerepo,
148 b'union': unionrepo,
148 b'union': unionrepo,
149 b'file': LocalFactory,
149 b'file': LocalFactory,
150 b'static-http': statichttprepo,
151 }
152
153 peer_schemes = {
150 b'http': httppeer,
154 b'http': httppeer,
151 b'https': httppeer,
155 b'https': httppeer,
152 b'ssh': sshpeer,
156 b'ssh': sshpeer,
153 b'static-http': statichttprepo,
154 }
157 }
155
158
156
159
157 def _peerlookup(path):
160 def _peerlookup(path):
158 u = urlutil.url(path)
161 u = urlutil.url(path)
159 scheme = u.scheme or b'file'
162 scheme = u.scheme or b'file'
160 thing = schemes.get(scheme) or schemes[b'file']
163 if scheme in peer_schemes:
161 return thing
164 return peer_schemes[scheme]
165 if scheme in repo_schemes:
166 return repo_schemes[scheme]
167 return LocalFactory
162
168
163
169
164 def islocal(repo):
170 def islocal(repo):
General Comments 0
You need to be logged in to leave comments. Login now