Show More
@@ -1,614 +1,614 b'' | |||
|
1 | 1 | #require killdaemons |
|
2 | 2 | |
|
3 | 3 | #testcases sshv1 sshv2 |
|
4 | 4 | |
|
5 | 5 | #if sshv2 |
|
6 | 6 | $ cat >> $HGRCPATH << EOF |
|
7 | 7 | > [experimental] |
|
8 | 8 | > sshpeer.advertise-v2 = true |
|
9 | 9 | > sshserver.support-v2 = true |
|
10 | 10 | > EOF |
|
11 | 11 | #endif |
|
12 | 12 | |
|
13 | 13 | Create an extension to test bundle2 remote-changegroup parts |
|
14 | 14 | |
|
15 | 15 | $ cat > bundle2.py << EOF |
|
16 | 16 | > """A small extension to test bundle2 remote-changegroup parts. |
|
17 | 17 | > |
|
18 | 18 | > Current bundle2 implementation doesn't provide a way to generate those |
|
19 | 19 | > parts, so they must be created by extensions. |
|
20 | 20 | > """ |
|
21 | 21 | > from mercurial import bundle2, changegroup, discovery, exchange, util |
|
22 | 22 | > |
|
23 | 23 | > def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None, |
|
24 | 24 | > b2caps=None, heads=None, common=None, |
|
25 | 25 | > **kwargs): |
|
26 | 26 | > """this function replaces the changegroup part handler for getbundle. |
|
27 | 27 | > It allows to create a set of arbitrary parts containing changegroups |
|
28 | 28 | > and remote-changegroups, as described in a bundle2maker file in the |
|
29 | 29 | > repository .hg/ directory. |
|
30 | 30 | > |
|
31 | 31 | > Each line of that bundle2maker file contain a description of the |
|
32 | 32 | > part to add: |
|
33 | 33 | > - changegroup common_revset heads_revset |
|
34 | 34 | > Creates a changegroup part based, using common_revset and |
|
35 | 35 | > heads_revset for outgoing |
|
36 | 36 | > - remote-changegroup url file |
|
37 | 37 | > Creates a remote-changegroup part for a bundle at the given |
|
38 | 38 | > url. Size and digest, as required by the client, are computed |
|
39 | 39 | > from the given file. |
|
40 | 40 | > - raw-remote-changegroup <python expression> |
|
41 | 41 | > Creates a remote-changegroup part with the data given in the |
|
42 | 42 | > Python expression as parameters. The Python expression is |
|
43 | 43 | > evaluated with eval, and is expected to be a dict. |
|
44 | 44 | > """ |
|
45 | 45 | > def newpart(name, data=''): |
|
46 | 46 | > """wrapper around bundler.newpart adding an extra part making the |
|
47 | 47 | > client output information about each processed part""" |
|
48 | 48 | > bundler.newpart('output', data=name) |
|
49 | 49 | > part = bundler.newpart(name, data=data) |
|
50 | 50 | > return part |
|
51 | 51 | > |
|
52 | 52 | > for line in open(repo.vfs.join('bundle2maker'), 'r'): |
|
53 | 53 | > line = line.strip() |
|
54 | 54 | > try: |
|
55 | 55 | > verb, args = line.split(None, 1) |
|
56 | 56 | > except ValueError: |
|
57 | 57 | > verb, args = line, '' |
|
58 | 58 | > if verb == 'remote-changegroup': |
|
59 | 59 | > url, file = args.split() |
|
60 | 60 | > bundledata = open(file, 'rb').read() |
|
61 | 61 | > digest = util.digester.preferred(b2caps['digests']) |
|
62 | 62 | > d = util.digester([digest], bundledata) |
|
63 | 63 | > part = newpart('remote-changegroup') |
|
64 | 64 | > part.addparam('url', url) |
|
65 | 65 | > part.addparam('size', str(len(bundledata))) |
|
66 | 66 | > part.addparam('digests', digest) |
|
67 | 67 | > part.addparam('digest:%s' % digest, d[digest]) |
|
68 | 68 | > elif verb == 'raw-remote-changegroup': |
|
69 | 69 | > part = newpart('remote-changegroup') |
|
70 | 70 | > for k, v in eval(args).items(): |
|
71 | 71 | > part.addparam(k, str(v)) |
|
72 | 72 | > elif verb == 'changegroup': |
|
73 | 73 | > _common, heads = args.split() |
|
74 |
> common.extend(repo. |
|
|
75 |
> heads = [repo. |
|
|
74 | > common.extend(repo[r].node() for r in repo.revs(_common)) | |
|
75 | > heads = [repo[r].node() for r in repo.revs(heads)] | |
|
76 | 76 | > outgoing = discovery.outgoing(repo, common, heads) |
|
77 | 77 | > cg = changegroup.makechangegroup(repo, outgoing, '01', |
|
78 | 78 | > 'changegroup') |
|
79 | 79 | > newpart('changegroup', cg.getchunks()) |
|
80 | 80 | > else: |
|
81 | 81 | > raise Exception('unknown verb') |
|
82 | 82 | > |
|
83 | 83 | > exchange.getbundle2partsmapping['changegroup'] = _getbundlechangegrouppart |
|
84 | 84 | > EOF |
|
85 | 85 | |
|
86 | 86 | Start a simple HTTP server to serve bundles |
|
87 | 87 | |
|
88 | 88 | $ $PYTHON "$TESTDIR/dumbhttp.py" -p $HGPORT --pid dumb.pid |
|
89 | 89 | $ cat dumb.pid >> $DAEMON_PIDS |
|
90 | 90 | |
|
91 | 91 | $ cat >> $HGRCPATH << EOF |
|
92 | 92 | > [ui] |
|
93 | 93 | > ssh=$PYTHON "$TESTDIR/dummyssh" |
|
94 | 94 | > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline} |
|
95 | 95 | > EOF |
|
96 | 96 | |
|
97 | 97 | $ hg init repo |
|
98 | 98 | |
|
99 | 99 | $ hg -R repo unbundle $TESTDIR/bundles/rebase.hg |
|
100 | 100 | adding changesets |
|
101 | 101 | adding manifests |
|
102 | 102 | adding file changes |
|
103 | 103 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
104 | 104 | new changesets cd010b8cd998:02de42196ebe |
|
105 | 105 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
106 | 106 | |
|
107 | 107 | $ hg -R repo log -G |
|
108 | 108 | o 7:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> H |
|
109 | 109 | | |
|
110 | 110 | | o 6:eea13746799a draft Nicolas Dumazet <nicdumz.commits@gmail.com> G |
|
111 | 111 | |/| |
|
112 | 112 | o | 5:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
113 | 113 | | | |
|
114 | 114 | | o 4:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
115 | 115 | |/ |
|
116 | 116 | | o 3:32af7686d403 draft Nicolas Dumazet <nicdumz.commits@gmail.com> D |
|
117 | 117 | | | |
|
118 | 118 | | o 2:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
119 | 119 | | | |
|
120 | 120 | | o 1:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
121 | 121 | |/ |
|
122 | 122 | o 0:cd010b8cd998 draft Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
123 | 123 | |
|
124 | 124 | $ hg clone repo orig |
|
125 | 125 | updating to branch default |
|
126 | 126 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
127 | 127 | |
|
128 | 128 | $ cat > repo/.hg/hgrc << EOF |
|
129 | 129 | > [extensions] |
|
130 | 130 | > bundle2=$TESTTMP/bundle2.py |
|
131 | 131 | > EOF |
|
132 | 132 | |
|
133 | 133 | Test a pull with an remote-changegroup |
|
134 | 134 | |
|
135 | 135 | $ hg bundle -R repo --type v1 --base '0:4' -r '5:7' bundle.hg |
|
136 | 136 | 3 changesets found |
|
137 | 137 | $ cat > repo/.hg/bundle2maker << EOF |
|
138 | 138 | > remote-changegroup http://localhost:$HGPORT/bundle.hg bundle.hg |
|
139 | 139 | > EOF |
|
140 | 140 | $ hg clone orig clone -r 3 -r 4 |
|
141 | 141 | adding changesets |
|
142 | 142 | adding manifests |
|
143 | 143 | adding file changes |
|
144 | 144 | added 5 changesets with 5 changes to 5 files (+1 heads) |
|
145 | 145 | new changesets cd010b8cd998:9520eea781bc |
|
146 | 146 | updating to branch default |
|
147 | 147 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
148 | 148 | $ hg pull -R clone ssh://user@dummy/repo |
|
149 | 149 | pulling from ssh://user@dummy/repo |
|
150 | 150 | searching for changes |
|
151 | 151 | remote: remote-changegroup |
|
152 | 152 | adding changesets |
|
153 | 153 | adding manifests |
|
154 | 154 | adding file changes |
|
155 | 155 | added 3 changesets with 2 changes to 2 files (+1 heads) |
|
156 | 156 | new changesets 24b6387c8c8c:02de42196ebe |
|
157 | 157 | (run 'hg heads .' to see heads, 'hg merge' to merge) |
|
158 | 158 | $ hg -R clone log -G |
|
159 | 159 | o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H |
|
160 | 160 | | |
|
161 | 161 | | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G |
|
162 | 162 | |/| |
|
163 | 163 | o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
164 | 164 | | | |
|
165 | 165 | | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
166 | 166 | |/ |
|
167 | 167 | | @ 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D |
|
168 | 168 | | | |
|
169 | 169 | | o 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
170 | 170 | | | |
|
171 | 171 | | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
172 | 172 | |/ |
|
173 | 173 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
174 | 174 | |
|
175 | 175 | $ rm -rf clone |
|
176 | 176 | |
|
177 | 177 | Test a pull with an remote-changegroup and a following changegroup |
|
178 | 178 | |
|
179 | 179 | $ hg bundle -R repo --type v1 --base 2 -r '3:4' bundle2.hg |
|
180 | 180 | 2 changesets found |
|
181 | 181 | $ cat > repo/.hg/bundle2maker << EOF |
|
182 | 182 | > remote-changegroup http://localhost:$HGPORT/bundle2.hg bundle2.hg |
|
183 | 183 | > changegroup 0:4 5:7 |
|
184 | 184 | > EOF |
|
185 | 185 | $ hg clone orig clone -r 2 |
|
186 | 186 | adding changesets |
|
187 | 187 | adding manifests |
|
188 | 188 | adding file changes |
|
189 | 189 | added 3 changesets with 3 changes to 3 files |
|
190 | 190 | new changesets cd010b8cd998:5fddd98957c8 |
|
191 | 191 | updating to branch default |
|
192 | 192 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
193 | 193 | $ hg pull -R clone ssh://user@dummy/repo |
|
194 | 194 | pulling from ssh://user@dummy/repo |
|
195 | 195 | searching for changes |
|
196 | 196 | remote: remote-changegroup |
|
197 | 197 | adding changesets |
|
198 | 198 | adding manifests |
|
199 | 199 | adding file changes |
|
200 | 200 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
201 | 201 | remote: changegroup |
|
202 | 202 | adding changesets |
|
203 | 203 | adding manifests |
|
204 | 204 | adding file changes |
|
205 | 205 | added 3 changesets with 2 changes to 2 files (+1 heads) |
|
206 | 206 | new changesets 32af7686d403:02de42196ebe |
|
207 | 207 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
208 | 208 | $ hg -R clone log -G |
|
209 | 209 | o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H |
|
210 | 210 | | |
|
211 | 211 | | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G |
|
212 | 212 | |/| |
|
213 | 213 | o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
214 | 214 | | | |
|
215 | 215 | | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
216 | 216 | |/ |
|
217 | 217 | | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D |
|
218 | 218 | | | |
|
219 | 219 | | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
220 | 220 | | | |
|
221 | 221 | | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
222 | 222 | |/ |
|
223 | 223 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
224 | 224 | |
|
225 | 225 | $ rm -rf clone |
|
226 | 226 | |
|
227 | 227 | Test a pull with a changegroup followed by an remote-changegroup |
|
228 | 228 | |
|
229 | 229 | $ hg bundle -R repo --type v1 --base '0:4' -r '5:7' bundle3.hg |
|
230 | 230 | 3 changesets found |
|
231 | 231 | $ cat > repo/.hg/bundle2maker << EOF |
|
232 | 232 | > changegroup 000000000000 :4 |
|
233 | 233 | > remote-changegroup http://localhost:$HGPORT/bundle3.hg bundle3.hg |
|
234 | 234 | > EOF |
|
235 | 235 | $ hg clone orig clone -r 2 |
|
236 | 236 | adding changesets |
|
237 | 237 | adding manifests |
|
238 | 238 | adding file changes |
|
239 | 239 | added 3 changesets with 3 changes to 3 files |
|
240 | 240 | new changesets cd010b8cd998:5fddd98957c8 |
|
241 | 241 | updating to branch default |
|
242 | 242 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
243 | 243 | $ hg pull -R clone ssh://user@dummy/repo |
|
244 | 244 | pulling from ssh://user@dummy/repo |
|
245 | 245 | searching for changes |
|
246 | 246 | remote: changegroup |
|
247 | 247 | adding changesets |
|
248 | 248 | adding manifests |
|
249 | 249 | adding file changes |
|
250 | 250 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
251 | 251 | remote: remote-changegroup |
|
252 | 252 | adding changesets |
|
253 | 253 | adding manifests |
|
254 | 254 | adding file changes |
|
255 | 255 | added 3 changesets with 2 changes to 2 files (+1 heads) |
|
256 | 256 | new changesets 32af7686d403:02de42196ebe |
|
257 | 257 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
258 | 258 | $ hg -R clone log -G |
|
259 | 259 | o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H |
|
260 | 260 | | |
|
261 | 261 | | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G |
|
262 | 262 | |/| |
|
263 | 263 | o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
264 | 264 | | | |
|
265 | 265 | | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
266 | 266 | |/ |
|
267 | 267 | | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D |
|
268 | 268 | | | |
|
269 | 269 | | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
270 | 270 | | | |
|
271 | 271 | | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
272 | 272 | |/ |
|
273 | 273 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
274 | 274 | |
|
275 | 275 | $ rm -rf clone |
|
276 | 276 | |
|
277 | 277 | Test a pull with two remote-changegroups and a changegroup |
|
278 | 278 | |
|
279 | 279 | $ hg bundle -R repo --type v1 --base 2 -r '3:4' bundle4.hg |
|
280 | 280 | 2 changesets found |
|
281 | 281 | $ hg bundle -R repo --type v1 --base '3:4' -r '5:6' bundle5.hg |
|
282 | 282 | 2 changesets found |
|
283 | 283 | $ cat > repo/.hg/bundle2maker << EOF |
|
284 | 284 | > remote-changegroup http://localhost:$HGPORT/bundle4.hg bundle4.hg |
|
285 | 285 | > remote-changegroup http://localhost:$HGPORT/bundle5.hg bundle5.hg |
|
286 | 286 | > changegroup 0:6 7 |
|
287 | 287 | > EOF |
|
288 | 288 | $ hg clone orig clone -r 2 |
|
289 | 289 | adding changesets |
|
290 | 290 | adding manifests |
|
291 | 291 | adding file changes |
|
292 | 292 | added 3 changesets with 3 changes to 3 files |
|
293 | 293 | new changesets cd010b8cd998:5fddd98957c8 |
|
294 | 294 | updating to branch default |
|
295 | 295 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
296 | 296 | $ hg pull -R clone ssh://user@dummy/repo |
|
297 | 297 | pulling from ssh://user@dummy/repo |
|
298 | 298 | searching for changes |
|
299 | 299 | remote: remote-changegroup |
|
300 | 300 | adding changesets |
|
301 | 301 | adding manifests |
|
302 | 302 | adding file changes |
|
303 | 303 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
304 | 304 | remote: remote-changegroup |
|
305 | 305 | adding changesets |
|
306 | 306 | adding manifests |
|
307 | 307 | adding file changes |
|
308 | 308 | added 2 changesets with 1 changes to 1 files |
|
309 | 309 | remote: changegroup |
|
310 | 310 | adding changesets |
|
311 | 311 | adding manifests |
|
312 | 312 | adding file changes |
|
313 | 313 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
314 | 314 | new changesets 32af7686d403:02de42196ebe |
|
315 | 315 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
316 | 316 | $ hg -R clone log -G |
|
317 | 317 | o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H |
|
318 | 318 | | |
|
319 | 319 | | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G |
|
320 | 320 | |/| |
|
321 | 321 | o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
322 | 322 | | | |
|
323 | 323 | | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
324 | 324 | |/ |
|
325 | 325 | | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D |
|
326 | 326 | | | |
|
327 | 327 | | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
328 | 328 | | | |
|
329 | 329 | | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
330 | 330 | |/ |
|
331 | 331 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
332 | 332 | |
|
333 | 333 | $ rm -rf clone |
|
334 | 334 | |
|
335 | 335 | Hash digest tests |
|
336 | 336 | |
|
337 | 337 | $ hg bundle -R repo --type v1 -a bundle6.hg |
|
338 | 338 | 8 changesets found |
|
339 | 339 | |
|
340 | 340 | $ cat > repo/.hg/bundle2maker << EOF |
|
341 | 341 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'sha1', 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'} |
|
342 | 342 | > EOF |
|
343 | 343 | $ hg clone ssh://user@dummy/repo clone |
|
344 | 344 | requesting all changes |
|
345 | 345 | remote: remote-changegroup |
|
346 | 346 | adding changesets |
|
347 | 347 | adding manifests |
|
348 | 348 | adding file changes |
|
349 | 349 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
350 | 350 | new changesets cd010b8cd998:02de42196ebe |
|
351 | 351 | updating to branch default |
|
352 | 352 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
353 | 353 | $ rm -rf clone |
|
354 | 354 | |
|
355 | 355 | $ cat > repo/.hg/bundle2maker << EOF |
|
356 | 356 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394'} |
|
357 | 357 | > EOF |
|
358 | 358 | $ hg clone ssh://user@dummy/repo clone |
|
359 | 359 | requesting all changes |
|
360 | 360 | remote: remote-changegroup |
|
361 | 361 | adding changesets |
|
362 | 362 | adding manifests |
|
363 | 363 | adding file changes |
|
364 | 364 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
365 | 365 | new changesets cd010b8cd998:02de42196ebe |
|
366 | 366 | updating to branch default |
|
367 | 367 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
368 | 368 | $ rm -rf clone |
|
369 | 369 | |
|
370 | 370 | Hash digest mismatch throws an error |
|
371 | 371 | |
|
372 | 372 | $ cat > repo/.hg/bundle2maker << EOF |
|
373 | 373 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'sha1', 'digest:sha1': '0' * 40} |
|
374 | 374 | > EOF |
|
375 | 375 | $ hg clone ssh://user@dummy/repo clone |
|
376 | 376 | requesting all changes |
|
377 | 377 | remote: remote-changegroup |
|
378 | 378 | adding changesets |
|
379 | 379 | adding manifests |
|
380 | 380 | adding file changes |
|
381 | 381 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
382 | 382 | transaction abort! |
|
383 | 383 | rollback completed |
|
384 | 384 | abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted: |
|
385 | 385 | sha1 mismatch: expected 0000000000000000000000000000000000000000, got 2c880cfec23cff7d8f80c2f12958d1563cbdaba6 |
|
386 | 386 | [255] |
|
387 | 387 | |
|
388 | 388 | Multiple hash digests can be given |
|
389 | 389 | |
|
390 | 390 | $ cat > repo/.hg/bundle2maker << EOF |
|
391 | 391 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394', 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'} |
|
392 | 392 | > EOF |
|
393 | 393 | $ hg clone ssh://user@dummy/repo clone |
|
394 | 394 | requesting all changes |
|
395 | 395 | remote: remote-changegroup |
|
396 | 396 | adding changesets |
|
397 | 397 | adding manifests |
|
398 | 398 | adding file changes |
|
399 | 399 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
400 | 400 | new changesets cd010b8cd998:02de42196ebe |
|
401 | 401 | updating to branch default |
|
402 | 402 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
403 | 403 | $ rm -rf clone |
|
404 | 404 | |
|
405 | 405 | If either of the multiple hash digests mismatches, an error is thrown |
|
406 | 406 | |
|
407 | 407 | $ cat > repo/.hg/bundle2maker << EOF |
|
408 | 408 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': '0' * 32, 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'} |
|
409 | 409 | > EOF |
|
410 | 410 | $ hg clone ssh://user@dummy/repo clone |
|
411 | 411 | requesting all changes |
|
412 | 412 | remote: remote-changegroup |
|
413 | 413 | adding changesets |
|
414 | 414 | adding manifests |
|
415 | 415 | adding file changes |
|
416 | 416 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
417 | 417 | transaction abort! |
|
418 | 418 | rollback completed |
|
419 | 419 | abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted: |
|
420 | 420 | md5 mismatch: expected 00000000000000000000000000000000, got e22172c2907ef88794b7bea6642c2394 |
|
421 | 421 | [255] |
|
422 | 422 | |
|
423 | 423 | $ cat > repo/.hg/bundle2maker << EOF |
|
424 | 424 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394', 'digest:sha1': '0' * 40} |
|
425 | 425 | > EOF |
|
426 | 426 | $ hg clone ssh://user@dummy/repo clone |
|
427 | 427 | requesting all changes |
|
428 | 428 | remote: remote-changegroup |
|
429 | 429 | adding changesets |
|
430 | 430 | adding manifests |
|
431 | 431 | adding file changes |
|
432 | 432 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
433 | 433 | transaction abort! |
|
434 | 434 | rollback completed |
|
435 | 435 | abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted: |
|
436 | 436 | sha1 mismatch: expected 0000000000000000000000000000000000000000, got 2c880cfec23cff7d8f80c2f12958d1563cbdaba6 |
|
437 | 437 | [255] |
|
438 | 438 | |
|
439 | 439 | Corruption tests |
|
440 | 440 | |
|
441 | 441 | $ hg clone orig clone -r 2 |
|
442 | 442 | adding changesets |
|
443 | 443 | adding manifests |
|
444 | 444 | adding file changes |
|
445 | 445 | added 3 changesets with 3 changes to 3 files |
|
446 | 446 | new changesets cd010b8cd998:5fddd98957c8 |
|
447 | 447 | updating to branch default |
|
448 | 448 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
449 | 449 | |
|
450 | 450 | $ cat > repo/.hg/bundle2maker << EOF |
|
451 | 451 | > remote-changegroup http://localhost:$HGPORT/bundle4.hg bundle4.hg |
|
452 | 452 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle5.hg', 'size': 578, 'digests': 'sha1', 'digest:sha1': '0' * 40} |
|
453 | 453 | > changegroup 0:6 7 |
|
454 | 454 | > EOF |
|
455 | 455 | $ hg pull -R clone ssh://user@dummy/repo |
|
456 | 456 | pulling from ssh://user@dummy/repo |
|
457 | 457 | searching for changes |
|
458 | 458 | remote: remote-changegroup |
|
459 | 459 | adding changesets |
|
460 | 460 | adding manifests |
|
461 | 461 | adding file changes |
|
462 | 462 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
463 | 463 | remote: remote-changegroup |
|
464 | 464 | adding changesets |
|
465 | 465 | adding manifests |
|
466 | 466 | adding file changes |
|
467 | 467 | added 2 changesets with 1 changes to 1 files |
|
468 | 468 | transaction abort! |
|
469 | 469 | rollback completed |
|
470 | 470 | abort: bundle at http://localhost:$HGPORT/bundle5.hg is corrupted: |
|
471 | 471 | sha1 mismatch: expected 0000000000000000000000000000000000000000, got f29485d6bfd37db99983cfc95ecb52f8ca396106 |
|
472 | 472 | [255] |
|
473 | 473 | |
|
474 | 474 | The entire transaction has been rolled back in the pull above |
|
475 | 475 | |
|
476 | 476 | $ hg -R clone log -G |
|
477 | 477 | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
478 | 478 | | |
|
479 | 479 | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
480 | 480 | | |
|
481 | 481 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
482 | 482 | |
|
483 | 483 | |
|
484 | 484 | No params |
|
485 | 485 | |
|
486 | 486 | $ cat > repo/.hg/bundle2maker << EOF |
|
487 | 487 | > raw-remote-changegroup {} |
|
488 | 488 | > EOF |
|
489 | 489 | $ hg pull -R clone ssh://user@dummy/repo |
|
490 | 490 | pulling from ssh://user@dummy/repo |
|
491 | 491 | searching for changes |
|
492 | 492 | remote: remote-changegroup |
|
493 | 493 | abort: remote-changegroup: missing "url" param |
|
494 | 494 | [255] |
|
495 | 495 | |
|
496 | 496 | Missing size |
|
497 | 497 | |
|
498 | 498 | $ cat > repo/.hg/bundle2maker << EOF |
|
499 | 499 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg'} |
|
500 | 500 | > EOF |
|
501 | 501 | $ hg pull -R clone ssh://user@dummy/repo |
|
502 | 502 | pulling from ssh://user@dummy/repo |
|
503 | 503 | searching for changes |
|
504 | 504 | remote: remote-changegroup |
|
505 | 505 | abort: remote-changegroup: missing "size" param |
|
506 | 506 | [255] |
|
507 | 507 | |
|
508 | 508 | Invalid size |
|
509 | 509 | |
|
510 | 510 | $ cat > repo/.hg/bundle2maker << EOF |
|
511 | 511 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 'foo'} |
|
512 | 512 | > EOF |
|
513 | 513 | $ hg pull -R clone ssh://user@dummy/repo |
|
514 | 514 | pulling from ssh://user@dummy/repo |
|
515 | 515 | searching for changes |
|
516 | 516 | remote: remote-changegroup |
|
517 | 517 | abort: remote-changegroup: invalid value for param "size" |
|
518 | 518 | [255] |
|
519 | 519 | |
|
520 | 520 | Size mismatch |
|
521 | 521 | |
|
522 | 522 | $ cat > repo/.hg/bundle2maker << EOF |
|
523 | 523 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 42} |
|
524 | 524 | > EOF |
|
525 | 525 | $ hg pull -R clone ssh://user@dummy/repo |
|
526 | 526 | pulling from ssh://user@dummy/repo |
|
527 | 527 | searching for changes |
|
528 | 528 | remote: remote-changegroup |
|
529 | 529 | adding changesets |
|
530 | 530 | adding manifests |
|
531 | 531 | adding file changes |
|
532 | 532 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
533 | 533 | transaction abort! |
|
534 | 534 | rollback completed |
|
535 | 535 | abort: bundle at http://localhost:$HGPORT/bundle4.hg is corrupted: |
|
536 | 536 | size mismatch: expected 42, got 581 |
|
537 | 537 | [255] |
|
538 | 538 | |
|
539 | 539 | Unknown digest |
|
540 | 540 | |
|
541 | 541 | $ cat > repo/.hg/bundle2maker << EOF |
|
542 | 542 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 581, 'digests': 'foo', 'digest:foo': 'bar'} |
|
543 | 543 | > EOF |
|
544 | 544 | $ hg pull -R clone ssh://user@dummy/repo |
|
545 | 545 | pulling from ssh://user@dummy/repo |
|
546 | 546 | searching for changes |
|
547 | 547 | remote: remote-changegroup |
|
548 | 548 | abort: missing support for remote-changegroup - digest:foo |
|
549 | 549 | [255] |
|
550 | 550 | |
|
551 | 551 | Missing digest |
|
552 | 552 | |
|
553 | 553 | $ cat > repo/.hg/bundle2maker << EOF |
|
554 | 554 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 581, 'digests': 'sha1'} |
|
555 | 555 | > EOF |
|
556 | 556 | $ hg pull -R clone ssh://user@dummy/repo |
|
557 | 557 | pulling from ssh://user@dummy/repo |
|
558 | 558 | searching for changes |
|
559 | 559 | remote: remote-changegroup |
|
560 | 560 | abort: remote-changegroup: missing "digest:sha1" param |
|
561 | 561 | [255] |
|
562 | 562 | |
|
563 | 563 | Not an HTTP url |
|
564 | 564 | |
|
565 | 565 | $ cat > repo/.hg/bundle2maker << EOF |
|
566 | 566 | > raw-remote-changegroup {'url': 'ssh://localhost:$HGPORT/bundle4.hg', 'size': 581} |
|
567 | 567 | > EOF |
|
568 | 568 | $ hg pull -R clone ssh://user@dummy/repo |
|
569 | 569 | pulling from ssh://user@dummy/repo |
|
570 | 570 | searching for changes |
|
571 | 571 | remote: remote-changegroup |
|
572 | 572 | abort: remote-changegroup does not support ssh urls |
|
573 | 573 | [255] |
|
574 | 574 | |
|
575 | 575 | Not a bundle |
|
576 | 576 | |
|
577 | 577 | $ cat > notbundle.hg << EOF |
|
578 | 578 | > foo |
|
579 | 579 | > EOF |
|
580 | 580 | $ cat > repo/.hg/bundle2maker << EOF |
|
581 | 581 | > remote-changegroup http://localhost:$HGPORT/notbundle.hg notbundle.hg |
|
582 | 582 | > EOF |
|
583 | 583 | $ hg pull -R clone ssh://user@dummy/repo |
|
584 | 584 | pulling from ssh://user@dummy/repo |
|
585 | 585 | searching for changes |
|
586 | 586 | remote: remote-changegroup |
|
587 | 587 | abort: http://localhost:$HGPORT/notbundle.hg: not a Mercurial bundle |
|
588 | 588 | [255] |
|
589 | 589 | |
|
590 | 590 | Not a bundle 1.0 |
|
591 | 591 | |
|
592 | 592 | $ cat > notbundle10.hg << EOF |
|
593 | 593 | > HG20 |
|
594 | 594 | > EOF |
|
595 | 595 | $ cat > repo/.hg/bundle2maker << EOF |
|
596 | 596 | > remote-changegroup http://localhost:$HGPORT/notbundle10.hg notbundle10.hg |
|
597 | 597 | > EOF |
|
598 | 598 | $ hg pull -R clone ssh://user@dummy/repo |
|
599 | 599 | pulling from ssh://user@dummy/repo |
|
600 | 600 | searching for changes |
|
601 | 601 | remote: remote-changegroup |
|
602 | 602 | abort: http://localhost:$HGPORT/notbundle10.hg: not a bundle version 1.0 |
|
603 | 603 | [255] |
|
604 | 604 | |
|
605 | 605 | $ hg -R clone log -G |
|
606 | 606 | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
607 | 607 | | |
|
608 | 608 | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
609 | 609 | | |
|
610 | 610 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
611 | 611 | |
|
612 | 612 | $ rm -rf clone |
|
613 | 613 | |
|
614 | 614 | $ killdaemons.py |
General Comments 0
You need to be logged in to leave comments.
Login now