##// END OF EJS Templates
bundlespec: allow the bundle spec to control the bundle version...
marmoute -
r50228:1fd7520e default
parent child Browse files
Show More
@@ -1,241 +1,270 b''
1 bundle w/o type option
1 bundle w/o type option
2
2
3 $ hg init t1
3 $ hg init t1
4 $ hg init t2
4 $ hg init t2
5 $ cd t1
5 $ cd t1
6 $ echo blablablablabla > file.txt
6 $ echo blablablablabla > file.txt
7 $ hg ci -Ama
7 $ hg ci -Ama
8 adding file.txt
8 adding file.txt
9 $ hg log | grep summary
9 $ hg log | grep summary
10 summary: a
10 summary: a
11 $ hg bundle ../b1 ../t2
11 $ hg bundle ../b1 ../t2
12 searching for changes
12 searching for changes
13 1 changesets found
13 1 changesets found
14
14
15 $ cd ../t2
15 $ cd ../t2
16 $ hg unbundle ../b1
16 $ hg unbundle ../b1
17 adding changesets
17 adding changesets
18 adding manifests
18 adding manifests
19 adding file changes
19 adding file changes
20 added 1 changesets with 1 changes to 1 files
20 added 1 changesets with 1 changes to 1 files
21 new changesets c35a0f9217e6 (1 drafts)
21 new changesets c35a0f9217e6 (1 drafts)
22 (run 'hg update' to get a working copy)
22 (run 'hg update' to get a working copy)
23 $ hg up
23 $ hg up
24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
25 $ hg log | grep summary
25 $ hg log | grep summary
26 summary: a
26 summary: a
27 $ cd ..
27 $ cd ..
28
28
29 Unknown compression type is rejected
29 Unknown compression type is rejected
30
30
31 $ hg init t3
31 $ hg init t3
32 $ cd t3
32 $ cd t3
33 $ hg -q unbundle ../b1
33 $ hg -q unbundle ../b1
34 $ hg bundle -a -t unknown out.hg
34 $ hg bundle -a -t unknown out.hg
35 abort: unknown is not a recognized bundle specification
35 abort: unknown is not a recognized bundle specification
36 (see 'hg help bundlespec' for supported values for --type)
36 (see 'hg help bundlespec' for supported values for --type)
37 [10]
37 [10]
38
38
39 $ hg bundle -a -t unknown-v2 out.hg
39 $ hg bundle -a -t unknown-v2 out.hg
40 abort: unknown compression is not supported
40 abort: unknown compression is not supported
41 (see 'hg help bundlespec' for supported values for --type)
41 (see 'hg help bundlespec' for supported values for --type)
42 [10]
42 [10]
43
43
44 $ cd ..
44 $ cd ..
45
45
46 test bundle types
46 test bundle types
47
47
48 $ testbundle() {
48 $ testbundle() {
49 > echo % test bundle type $1
49 > echo % test bundle type $1
50 > hg init t$1
50 > hg init t$1
51 > cd t1
51 > cd t1
52 > hg bundle -t $1 ../b$1 ../t$1
52 > hg bundle -t $1 ../b$1 ../t$1
53 > f -q -B6 -D ../b$1; echo
53 > f -q -B6 -D ../b$1; echo
54 > cd ../t$1
54 > cd ../t$1
55 > hg debugbundle ../b$1
55 > hg debugbundle ../b$1
56 > hg debugbundle --spec ../b$1
56 > hg debugbundle --spec ../b$1
57 > echo
57 > echo
58 > cd ..
58 > cd ..
59 > }
59 > }
60
60
61 $ for t in "None" "bzip2" "gzip" "none-v2" "v2" "v1" "gzip-v1"; do
61 $ for t in "None" "bzip2" "gzip" "none-v2" "v2" "v1" "gzip-v1"; do
62 > testbundle $t
62 > testbundle $t
63 > done
63 > done
64 % test bundle type None
64 % test bundle type None
65 searching for changes
65 searching for changes
66 1 changesets found
66 1 changesets found
67 HG20\x00\x00 (esc)
67 HG20\x00\x00 (esc)
68 Stream params: {}
68 Stream params: {}
69 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
69 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
70 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
70 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
71 cache:rev-branch-cache -- {} (mandatory: False)
71 cache:rev-branch-cache -- {} (mandatory: False)
72 none-v2
72 none-v2
73
73
74 % test bundle type bzip2
74 % test bundle type bzip2
75 searching for changes
75 searching for changes
76 1 changesets found
76 1 changesets found
77 HG20\x00\x00 (esc)
77 HG20\x00\x00 (esc)
78 Stream params: {Compression: BZ}
78 Stream params: {Compression: BZ}
79 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
79 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
80 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
80 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
81 cache:rev-branch-cache -- {} (mandatory: False)
81 cache:rev-branch-cache -- {} (mandatory: False)
82 bzip2-v2
82 bzip2-v2
83
83
84 % test bundle type gzip
84 % test bundle type gzip
85 searching for changes
85 searching for changes
86 1 changesets found
86 1 changesets found
87 HG20\x00\x00 (esc)
87 HG20\x00\x00 (esc)
88 Stream params: {Compression: GZ}
88 Stream params: {Compression: GZ}
89 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
89 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
90 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
90 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
91 cache:rev-branch-cache -- {} (mandatory: False)
91 cache:rev-branch-cache -- {} (mandatory: False)
92 gzip-v2
92 gzip-v2
93
93
94 % test bundle type none-v2
94 % test bundle type none-v2
95 searching for changes
95 searching for changes
96 1 changesets found
96 1 changesets found
97 HG20\x00\x00 (esc)
97 HG20\x00\x00 (esc)
98 Stream params: {}
98 Stream params: {}
99 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
99 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
100 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
100 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
101 cache:rev-branch-cache -- {} (mandatory: False)
101 cache:rev-branch-cache -- {} (mandatory: False)
102 none-v2
102 none-v2
103
103
104 % test bundle type v2
104 % test bundle type v2
105 searching for changes
105 searching for changes
106 1 changesets found
106 1 changesets found
107 HG20\x00\x00 (esc)
107 HG20\x00\x00 (esc)
108 Stream params: {Compression: BZ}
108 Stream params: {Compression: BZ}
109 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
109 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
110 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
110 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
111 cache:rev-branch-cache -- {} (mandatory: False)
111 cache:rev-branch-cache -- {} (mandatory: False)
112 bzip2-v2
112 bzip2-v2
113
113
114 % test bundle type v1
114 % test bundle type v1
115 searching for changes
115 searching for changes
116 1 changesets found
116 1 changesets found
117 HG10BZ
117 HG10BZ
118 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
118 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
119 bzip2-v1
119 bzip2-v1
120
120
121 % test bundle type gzip-v1
121 % test bundle type gzip-v1
122 searching for changes
122 searching for changes
123 1 changesets found
123 1 changesets found
124 HG10GZ
124 HG10GZ
125 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
125 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
126 gzip-v1
126 gzip-v1
127
127
128
128
129 Compression level can be adjusted for bundle2 bundles
129 Compression level can be adjusted for bundle2 bundles
130
130
131 $ hg init test-complevel
131 $ hg init test-complevel
132 $ cd test-complevel
132 $ cd test-complevel
133
133
134 $ cat > file0 << EOF
134 $ cat > file0 << EOF
135 > this is a file
135 > this is a file
136 > with some text
136 > with some text
137 > and some more text
137 > and some more text
138 > and other content
138 > and other content
139 > EOF
139 > EOF
140 $ cat > file1 << EOF
140 $ cat > file1 << EOF
141 > this is another file
141 > this is another file
142 > with some other content
142 > with some other content
143 > and repeated, repeated, repeated, repeated content
143 > and repeated, repeated, repeated, repeated content
144 > EOF
144 > EOF
145 $ hg -q commit -A -m initial
145 $ hg -q commit -A -m initial
146
146
147 $ hg bundle -a -t gzip-v2 gzip-v2.hg
147 $ hg bundle -a -t gzip-v2 gzip-v2.hg
148 1 changesets found
148 1 changesets found
149 $ f --size gzip-v2.hg
149 $ f --size gzip-v2.hg
150 gzip-v2.hg: size=468
150 gzip-v2.hg: size=468
151
151
152 $ hg --config experimental.bundlecomplevel=1 bundle -a -t gzip-v2 gzip-v2-level1.hg
152 $ hg --config experimental.bundlecomplevel=1 bundle -a -t gzip-v2 gzip-v2-level1.hg
153 1 changesets found
153 1 changesets found
154 $ f --size gzip-v2-level1.hg
154 $ f --size gzip-v2-level1.hg
155 gzip-v2-level1.hg: size=475
155 gzip-v2-level1.hg: size=475
156
156
157 $ hg --config experimental.bundlecomplevel.gzip=1 --config experimental.bundlelevel=9 bundle -a -t gzip-v2 gzip-v2-level1.hg
157 $ hg --config experimental.bundlecomplevel.gzip=1 --config experimental.bundlelevel=9 bundle -a -t gzip-v2 gzip-v2-level1.hg
158 1 changesets found
158 1 changesets found
159 $ f --size gzip-v2-level1.hg
159 $ f --size gzip-v2-level1.hg
160 gzip-v2-level1.hg: size=475
160 gzip-v2-level1.hg: size=475
161
161
162 $ cd ..
162 $ cd ..
163
163
164 #if zstd
164 #if zstd
165
165
166 $ for t in "zstd" "zstd-v2"; do
166 $ for t in "zstd" "zstd-v2"; do
167 > testbundle $t
167 > testbundle $t
168 > done
168 > done
169 % test bundle type zstd
169 % test bundle type zstd
170 searching for changes
170 searching for changes
171 1 changesets found
171 1 changesets found
172 HG20\x00\x00 (esc)
172 HG20\x00\x00 (esc)
173 Stream params: {Compression: ZS}
173 Stream params: {Compression: ZS}
174 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
174 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
175 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
175 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
176 cache:rev-branch-cache -- {} (mandatory: False)
176 cache:rev-branch-cache -- {} (mandatory: False)
177 zstd-v2
177 zstd-v2
178
178
179 % test bundle type zstd-v2
179 % test bundle type zstd-v2
180 searching for changes
180 searching for changes
181 1 changesets found
181 1 changesets found
182 HG20\x00\x00 (esc)
182 HG20\x00\x00 (esc)
183 Stream params: {Compression: ZS}
183 Stream params: {Compression: ZS}
184 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
184 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
185 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
185 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
186 cache:rev-branch-cache -- {} (mandatory: False)
186 cache:rev-branch-cache -- {} (mandatory: False)
187 zstd-v2
187 zstd-v2
188
188
189
189
190 Explicit request for zstd on non-generaldelta repos
190 Explicit request for zstd on non-generaldelta repos
191
191
192 $ hg --config format.usegeneraldelta=false init nogd
192 $ hg --config format.usegeneraldelta=false init nogd
193 $ hg -q -R nogd pull t1
193 $ hg -q -R nogd pull t1
194 $ hg -R nogd bundle -a -t zstd nogd-zstd
194 $ hg -R nogd bundle -a -t zstd nogd-zstd
195 1 changesets found
195 1 changesets found
196
196
197 zstd-v1 always fails
197 zstd-v1 always fails
198
198
199 $ hg -R tzstd bundle -a -t zstd-v1 zstd-v1
199 $ hg -R tzstd bundle -a -t zstd-v1 zstd-v1
200 abort: compression engine zstd is not supported on v1 bundles
200 abort: compression engine zstd is not supported on v1 bundles
201 (see 'hg help bundlespec' for supported values for --type)
201 (see 'hg help bundlespec' for supported values for --type)
202 [10]
202 [10]
203
203
204 zstd supports threading
204 zstd supports threading
205
205
206 $ hg init test-compthreads
206 $ hg init test-compthreads
207 $ cd test-compthreads
207 $ cd test-compthreads
208 $ hg debugbuilddag +3
208 $ hg debugbuilddag +3
209 $ hg --config experimental.bundlecompthreads=1 bundle -a -t zstd-v2 zstd-v2-threaded.hg
209 $ hg --config experimental.bundlecompthreads=1 bundle -a -t zstd-v2 zstd-v2-threaded.hg
210 3 changesets found
210 3 changesets found
211 $ cd ..
211 $ cd ..
212
212
213 #else
213 #else
214
214
215 zstd is a valid engine but isn't available
215 zstd is a valid engine but isn't available
216
216
217 $ hg -R t1 bundle -a -t zstd irrelevant.hg
217 $ hg -R t1 bundle -a -t zstd irrelevant.hg
218 abort: compression engine zstd could not be loaded
218 abort: compression engine zstd could not be loaded
219 [255]
219 [255]
220
220
221 #endif
221 #endif
222
222
223 test garbage file
223 test garbage file
224
224
225 $ echo garbage > bgarbage
225 $ echo garbage > bgarbage
226 $ hg init tgarbage
226 $ hg init tgarbage
227 $ cd tgarbage
227 $ cd tgarbage
228 $ hg pull ../bgarbage
228 $ hg pull ../bgarbage
229 pulling from ../bgarbage
229 pulling from ../bgarbage
230 abort: ../bgarbage: not a Mercurial bundle
230 abort: ../bgarbage: not a Mercurial bundle
231 [255]
231 [255]
232 $ cd ..
232 $ cd ..
233
233
234 test invalid bundle type
234 test invalid bundle type
235
235
236 $ cd t1
236 $ cd t1
237 $ hg bundle -a -t garbage ../bgarbage
237 $ hg bundle -a -t garbage ../bgarbage
238 abort: garbage is not a recognized bundle specification
238 abort: garbage is not a recognized bundle specification
239 (see 'hg help bundlespec' for supported values for --type)
239 (see 'hg help bundlespec' for supported values for --type)
240 [10]
240 [10]
241 $ cd ..
241 $ cd ..
242
243 Test controlling the changegroup version
244
245 $ hg -R t1 bundle --config experimental.changegroup3=yes -a -t v2 ./v2-cg-default.hg
246 1 changesets found
247 $ hg debugbundle ./v2-cg-default.hg --part-type changegroup
248 Stream params: {Compression: BZ}
249 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
250 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
251 $ hg debugbundle ./v2-cg-default.hg --spec
252 bzip2-v2
253 $ hg -R t1 bundle --config experimental.changegroup3=yes -a -t 'v2;cg.version=02' ./v2-cg-02.hg
254 1 changesets found
255 $ hg debugbundle ./v2-cg-02.hg --part-type changegroup
256 Stream params: {Compression: BZ}
257 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
258 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
259 $ hg debugbundle ./v2-cg-02.hg --spec
260 bzip2-v2
261 $ hg -R t1 bundle --config experimental.changegroup3=yes -a -t 'v2;cg.version=03' ./v2-cg-03.hg
262 1 changesets found
263 $ hg debugbundle ./v2-cg-03.hg --part-type changegroup
264 Stream params: {Compression: BZ}
265 changegroup -- {nbchanges: 1, version: 03} (mandatory: True)
266 c35a0f9217e65d1fdb90c936ffa7dbe679f83ddf
267 $ hg debugbundle ./v2-cg-03.hg --spec
268 abort: changegroup version 03 does not have a known bundlespec (known-bad-output !)
269 (try upgrading your Mercurial client) (known-bad-output !)
270 [255]
General Comments 0
You need to be logged in to leave comments. Login now