##// END OF EJS Templates
exchange: obtain compression engines from the registrar...
Gregory Szorc -
r30440:c3944ab1 default
parent child Browse files
Show More
@@ -37,12 +37,6 b' from . import ('
37 urlerr = util.urlerr
37 urlerr = util.urlerr
38 urlreq = util.urlreq
38 urlreq = util.urlreq
39
39
40 # Maps bundle compression human names to internal representation.
41 _bundlespeccompressions = {'none': None,
42 'bzip2': 'BZ',
43 'gzip': 'GZ',
44 }
45
46 # Maps bundle version human names to changegroup versions.
40 # Maps bundle version human names to changegroup versions.
47 _bundlespeccgversions = {'v1': '01',
41 _bundlespeccgversions = {'v1': '01',
48 'v2': '02',
42 'v2': '02',
@@ -114,7 +108,7 b' def parsebundlespec(repo, spec, strict=T'
114 if '-' in spec:
108 if '-' in spec:
115 compression, version = spec.split('-', 1)
109 compression, version = spec.split('-', 1)
116
110
117 if compression not in _bundlespeccompressions:
111 if compression not in util.compengines.supportedbundlenames:
118 raise error.UnsupportedBundleSpecification(
112 raise error.UnsupportedBundleSpecification(
119 _('%s compression is not supported') % compression)
113 _('%s compression is not supported') % compression)
120
114
@@ -130,7 +124,7 b' def parsebundlespec(repo, spec, strict=T'
130
124
131 spec, params = parseparams(spec)
125 spec, params = parseparams(spec)
132
126
133 if spec in _bundlespeccompressions:
127 if spec in util.compengines.supportedbundlenames:
134 compression = spec
128 compression = spec
135 version = 'v1'
129 version = 'v1'
136 if 'generaldelta' in repo.requirements:
130 if 'generaldelta' in repo.requirements:
@@ -157,7 +151,8 b' def parsebundlespec(repo, spec, strict=T'
157 ', '.join(sorted(missingreqs)))
151 ', '.join(sorted(missingreqs)))
158
152
159 if not externalnames:
153 if not externalnames:
160 compression = _bundlespeccompressions[compression]
154 engine = util.compengines.forbundlename(compression)
155 compression = engine.bundletype()[1]
161 version = _bundlespeccgversions[version]
156 version = _bundlespeccgversions[version]
162 return compression, version, params
157 return compression, version, params
163
158
@@ -196,10 +191,10 b' def getbundlespec(ui, fh):'
196 restored.
191 restored.
197 """
192 """
198 def speccompression(alg):
193 def speccompression(alg):
199 for k, v in _bundlespeccompressions.items():
194 try:
200 if v == alg:
195 return util.compengines.forbundletype(alg).bundletype()[0]
201 return k
196 except KeyError:
202 return None
197 return None
203
198
204 b = readbundle(ui, fh, None)
199 b = readbundle(ui, fh, None)
205 if isinstance(b, changegroup.cg1unpacker):
200 if isinstance(b, changegroup.cg1unpacker):
General Comments 0
You need to be logged in to leave comments. Login now