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