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 | |||
@@ -127,8 +130,12 b' def parsebundlespec(repo, spec, strict=T' | |||||
127 | if spec in util.compengines.supportedbundlenames: |
|
130 | if spec in util.compengines.supportedbundlenames: | |
128 | compression = spec |
|
131 | compression = spec | |
129 | version = 'v1' |
|
132 | version = 'v1' | |
|
133 | # Generaldelta repos require v2. | |||
130 | if 'generaldelta' in repo.requirements: |
|
134 | if 'generaldelta' in repo.requirements: | |
131 | version = 'v2' |
|
135 | version = 'v2' | |
|
136 | # Modern compression engines require v2. | |||
|
137 | if compression not in _bundlespecv1compengines: | |||
|
138 | version = 'v2' | |||
132 | elif spec in _bundlespeccgversions: |
|
139 | elif spec in _bundlespeccgversions: | |
133 | if spec == 'packed1': |
|
140 | if spec == 'packed1': | |
134 | compression = 'none' |
|
141 | compression = 'none' | |
@@ -139,6 +146,12 b' def parsebundlespec(repo, spec, strict=T' | |||||
139 | raise error.UnsupportedBundleSpecification( |
|
146 | raise error.UnsupportedBundleSpecification( | |
140 | _('%s is not a recognized bundle specification') % spec) |
|
147 | _('%s is not a recognized bundle specification') % spec) | |
141 |
|
148 | |||
|
149 | # Bundle version 1 only supports a known set of compression engines. | |||
|
150 | if version == 'v1' and compression not in _bundlespecv1compengines: | |||
|
151 | raise error.UnsupportedBundleSpecification( | |||
|
152 | _('compression engine %s is not supported on v1 bundles') % | |||
|
153 | compression) | |||
|
154 | ||||
142 | # The specification for packed1 can optionally declare the data formats |
|
155 | # The specification for packed1 can optionally declare the data formats | |
143 | # required to apply it. If we see this metadata, compare against what the |
|
156 | # required to apply it. If we see this metadata, compare against what the | |
144 | # repo supports and error if the bundle isn't compatible. |
|
157 | # 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,21 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 | 1 changesets found | |||
|
191 | ||||
|
192 | zstd-v1 always fails | |||
|
193 | ||||
|
194 | $ hg -R tzstd bundle -a -t zstd-v1 zstd-v1 | |||
|
195 | abort: compression engine zstd is not supported on v1 bundles | |||
|
196 | (see 'hg help bundle' for supported values for --type) | |||
|
197 | [255] | |||
|
198 | ||||
167 | #else |
|
199 | #else | |
168 |
|
200 | |||
169 | zstd is a valid engine but isn't available |
|
201 | zstd is a valid engine but isn't available |
General Comments 0
You need to be logged in to leave comments.
Login now