##// END OF EJS Templates
exchange: reject new compression engines for v1 bundles (issue5506)...
Gregory Szorc -
r31473:ffed3bf5 stable
parent child Browse files
Show More
@@ -44,6 +44,9 b' urlreq = util.urlreq'
44 'bundle2': '02', #legacy
44 'bundle2': '02', #legacy
45 }
45 }
46
46
47 # Compression engines allowed in version 1. THIS SHOULD NEVER CHANGE.
48 _bundlespecv1compengines = set(['gzip', 'bzip2', 'none'])
49
47 def parsebundlespec(repo, spec, strict=True, externalnames=False):
50 def parsebundlespec(repo, spec, strict=True, externalnames=False):
48 """Parse a bundle string specification into parts.
51 """Parse a bundle string specification into parts.
49
52
@@ -139,6 +142,12 b' def parsebundlespec(repo, spec, strict=T'
139 raise error.UnsupportedBundleSpecification(
142 raise error.UnsupportedBundleSpecification(
140 _('%s is not a recognized bundle specification') % spec)
143 _('%s is not a recognized bundle specification') % spec)
141
144
145 # Bundle version 1 only supports a known set of compression engines.
146 if version == 'v1' and compression not in _bundlespecv1compengines:
147 raise error.UnsupportedBundleSpecification(
148 _('compression engine %s is not supported on v1 bundles') %
149 compression)
150
142 # The specification for packed1 can optionally declare the data formats
151 # The specification for packed1 can optionally declare the data formats
143 # required to apply it. If we see this metadata, compare against what the
152 # required to apply it. If we see this metadata, compare against what the
144 # repo supports and error if the bundle isn't compatible.
153 # repo supports and error if the bundle isn't compatible.
@@ -33,6 +33,23 b' bundle w/o type option'
33 summary: a
33 summary: a
34 $ cd ..
34 $ cd ..
35
35
36 Unknown compression type is rejected
37
38 $ hg init t3
39 $ cd t3
40 $ hg -q pull ../b1
41 $ hg bundle -a -t unknown out.hg
42 abort: unknown is not a recognized bundle specification
43 (see 'hg help bundle' for supported values for --type)
44 [255]
45
46 $ hg bundle -a -t unknown-v2 out.hg
47 abort: unknown compression is not supported
48 (see 'hg help bundle' for supported values for --type)
49 [255]
50
51 $ cd ..
52
36 test bundle types
53 test bundle types
37
54
38 $ testbundle() {
55 $ testbundle() {
@@ -164,6 +181,23 b' Compression level can be adjusted for bu'
164 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
181 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
165 zstd-v2
182 zstd-v2
166
183
184
185 Explicit request for zstd on non-generaldelta repos
186
187 $ hg --config format.usegeneraldelta=false init nogd
188 $ hg -q -R nogd pull t1
189 $ hg -R nogd bundle -a -t zstd nogd-zstd
190 abort: compression engine zstd is not supported on v1 bundles
191 (see 'hg help bundle' for supported values for --type)
192 [255]
193
194 zstd-v1 always fails
195
196 $ hg -R tzstd bundle -a -t zstd-v1 zstd-v1
197 abort: compression engine zstd is not supported on v1 bundles
198 (see 'hg help bundle' for supported values for --type)
199 [255]
200
167 #else
201 #else
168
202
169 zstd is a valid engine but isn't available
203 zstd is a valid engine but isn't available
General Comments 0
You need to be logged in to leave comments. Login now