##// END OF EJS Templates
test-bundle2: add bookmark movement to the push test...
Pierre-Yves David -
r22241:3dc3cf8d default
parent child Browse files
Show More
@@ -1,1108 +1,1132 b''
1 1
2 2 Create an extension to test bundle2 API
3 3
4 4 $ cat > bundle2.py << EOF
5 5 > """A small extension to test bundle2 implementation
6 6 >
7 7 > Current bundle2 implementation is far too limited to be used in any core
8 8 > code. We still need to be able to test it while it grow up.
9 9 > """
10 10 >
11 11 > import sys, os
12 12 > from mercurial import cmdutil
13 13 > from mercurial import util
14 14 > from mercurial import bundle2
15 15 > from mercurial import scmutil
16 16 > from mercurial import discovery
17 17 > from mercurial import changegroup
18 18 > from mercurial import error
19 19 >
20 20 > try:
21 21 > import msvcrt
22 22 > msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
23 23 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
24 24 > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
25 25 > except ImportError:
26 26 > pass
27 27 >
28 28 > cmdtable = {}
29 29 > command = cmdutil.command(cmdtable)
30 30 >
31 31 > ELEPHANTSSONG = """Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
32 32 > Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
33 33 > Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko."""
34 34 > assert len(ELEPHANTSSONG) == 178 # future test say 178 bytes, trust it.
35 35 >
36 36 > @bundle2.parthandler('test:song')
37 37 > def songhandler(op, part):
38 38 > """handle a "test:song" bundle2 part, printing the lyrics on stdin"""
39 39 > op.ui.write('The choir starts singing:\n')
40 40 > verses = 0
41 41 > for line in part.read().split('\n'):
42 42 > op.ui.write(' %s\n' % line)
43 43 > verses += 1
44 44 > op.records.add('song', {'verses': verses})
45 45 >
46 46 > @bundle2.parthandler('test:ping')
47 47 > def pinghandler(op, part):
48 48 > op.ui.write('received ping request (id %i)\n' % part.id)
49 49 > if op.reply is not None and 'ping-pong' in op.reply.capabilities:
50 50 > op.ui.write_err('replying to ping request (id %i)\n' % part.id)
51 51 > op.reply.newpart('test:pong', [('in-reply-to', str(part.id))])
52 52 >
53 53 > @bundle2.parthandler('test:debugreply')
54 54 > def debugreply(op, part):
55 55 > """print data about the capacity of the bundle reply"""
56 56 > if op.reply is None:
57 57 > op.ui.write('debugreply: no reply\n')
58 58 > else:
59 59 > op.ui.write('debugreply: capabilities:\n')
60 60 > for cap in sorted(op.reply.capabilities):
61 61 > op.ui.write('debugreply: %r\n' % cap)
62 62 > for val in op.reply.capabilities[cap]:
63 63 > op.ui.write('debugreply: %r\n' % val)
64 64 >
65 65 > @command('bundle2',
66 66 > [('', 'param', [], 'stream level parameter'),
67 67 > ('', 'unknown', False, 'include an unknown mandatory part in the bundle'),
68 68 > ('', 'unknownparams', False, 'include an unknown part parameters in the bundle'),
69 69 > ('', 'parts', False, 'include some arbitrary parts to the bundle'),
70 70 > ('', 'reply', False, 'produce a reply bundle'),
71 71 > ('', 'pushrace', False, 'includes a check:head part with unknown nodes'),
72 72 > ('r', 'rev', [], 'includes those changeset in the bundle'),],
73 73 > '[OUTPUTFILE]')
74 74 > def cmdbundle2(ui, repo, path=None, **opts):
75 75 > """write a bundle2 container on standard ouput"""
76 76 > bundler = bundle2.bundle20(ui)
77 77 > for p in opts['param']:
78 78 > p = p.split('=', 1)
79 79 > try:
80 80 > bundler.addparam(*p)
81 81 > except ValueError, exc:
82 82 > raise util.Abort('%s' % exc)
83 83 >
84 84 > if opts['reply']:
85 85 > capsstring = 'ping-pong\nelephants=babar,celeste\ncity%3D%21=celeste%2Cville'
86 86 > bundler.newpart('b2x:replycaps', data=capsstring)
87 87 >
88 88 > if opts['pushrace']:
89 89 > # also serve to test the assignement of data outside of init
90 90 > part = bundler.newpart('b2x:check:heads')
91 91 > part.data = '01234567890123456789'
92 92 >
93 93 > revs = opts['rev']
94 94 > if 'rev' in opts:
95 95 > revs = scmutil.revrange(repo, opts['rev'])
96 96 > if revs:
97 97 > # very crude version of a changegroup part creation
98 98 > bundled = repo.revs('%ld::%ld', revs, revs)
99 99 > headmissing = [c.node() for c in repo.set('heads(%ld)', revs)]
100 100 > headcommon = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)]
101 101 > outgoing = discovery.outgoing(repo.changelog, headcommon, headmissing)
102 102 > cg = changegroup.getlocalbundle(repo, 'test:bundle2', outgoing, None)
103 103 > bundler.newpart('b2x:changegroup', data=cg.getchunks())
104 104 >
105 105 > if opts['parts']:
106 106 > bundler.newpart('test:empty')
107 107 > # add a second one to make sure we handle multiple parts
108 108 > bundler.newpart('test:empty')
109 109 > bundler.newpart('test:song', data=ELEPHANTSSONG)
110 110 > bundler.newpart('test:debugreply')
111 111 > mathpart = bundler.newpart('test:math')
112 112 > mathpart.addparam('pi', '3.14')
113 113 > mathpart.addparam('e', '2.72')
114 114 > mathpart.addparam('cooking', 'raw', mandatory=False)
115 115 > mathpart.data = '42'
116 116 > # advisory known part with unknown mandatory param
117 117 > bundler.newpart('test:song', [('randomparam','')])
118 118 > if opts['unknown']:
119 119 > bundler.newpart('test:UNKNOWN', data='some random content')
120 120 > if opts['unknownparams']:
121 121 > bundler.newpart('test:SONG', [('randomparams', '')])
122 122 > if opts['parts']:
123 123 > bundler.newpart('test:ping')
124 124 >
125 125 > if path is None:
126 126 > file = sys.stdout
127 127 > else:
128 128 > file = open(path, 'wb')
129 129 >
130 130 > for chunk in bundler.getchunks():
131 131 > file.write(chunk)
132 132 >
133 133 > @command('unbundle2', [], '')
134 134 > def cmdunbundle2(ui, repo, replypath=None):
135 135 > """process a bundle2 stream from stdin on the current repo"""
136 136 > try:
137 137 > tr = None
138 138 > lock = repo.lock()
139 139 > tr = repo.transaction('processbundle')
140 140 > try:
141 141 > unbundler = bundle2.unbundle20(ui, sys.stdin)
142 142 > op = bundle2.processbundle(repo, unbundler, lambda: tr)
143 143 > tr.close()
144 144 > except error.BundleValueError, exc:
145 145 > raise util.Abort('missing support for %s' % exc)
146 146 > except error.PushRaced, exc:
147 147 > raise util.Abort('push race: %s' % exc)
148 148 > finally:
149 149 > if tr is not None:
150 150 > tr.release()
151 151 > lock.release()
152 152 > remains = sys.stdin.read()
153 153 > ui.write('%i unread bytes\n' % len(remains))
154 154 > if op.records['song']:
155 155 > totalverses = sum(r['verses'] for r in op.records['song'])
156 156 > ui.write('%i total verses sung\n' % totalverses)
157 157 > for rec in op.records['changegroup']:
158 158 > ui.write('addchangegroup return: %i\n' % rec['return'])
159 159 > if op.reply is not None and replypath is not None:
160 160 > file = open(replypath, 'wb')
161 161 > for chunk in op.reply.getchunks():
162 162 > file.write(chunk)
163 163 >
164 164 > @command('statbundle2', [], '')
165 165 > def cmdstatbundle2(ui, repo):
166 166 > """print statistic on the bundle2 container read from stdin"""
167 167 > unbundler = bundle2.unbundle20(ui, sys.stdin)
168 168 > try:
169 169 > params = unbundler.params
170 170 > except error.BundleValueError, exc:
171 171 > raise util.Abort('unknown parameters: %s' % exc)
172 172 > ui.write('options count: %i\n' % len(params))
173 173 > for key in sorted(params):
174 174 > ui.write('- %s\n' % key)
175 175 > value = params[key]
176 176 > if value is not None:
177 177 > ui.write(' %s\n' % value)
178 178 > count = 0
179 179 > for p in unbundler.iterparts():
180 180 > count += 1
181 181 > ui.write(' :%s:\n' % p.type)
182 182 > ui.write(' mandatory: %i\n' % len(p.mandatoryparams))
183 183 > ui.write(' advisory: %i\n' % len(p.advisoryparams))
184 184 > ui.write(' payload: %i bytes\n' % len(p.read()))
185 185 > ui.write('parts count: %i\n' % count)
186 186 > EOF
187 187 $ cat >> $HGRCPATH << EOF
188 188 > [extensions]
189 189 > bundle2=$TESTTMP/bundle2.py
190 190 > [experimental]
191 191 > bundle2-exp=True
192 192 > [ui]
193 193 > ssh=python "$TESTDIR/dummyssh"
194 > logtemplate={rev}:{node|short} {phase} {author} {desc|firstline}
194 > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
195 195 > [web]
196 196 > push_ssl = false
197 197 > allow_push = *
198 198 > [phases]
199 199 > publish=False
200 200 > EOF
201 201
202 202 The extension requires a repo (currently unused)
203 203
204 204 $ hg init main
205 205 $ cd main
206 206 $ touch a
207 207 $ hg add a
208 208 $ hg commit -m 'a'
209 209
210 210
211 211 Empty bundle
212 212 =================
213 213
214 214 - no option
215 215 - no parts
216 216
217 217 Test bundling
218 218
219 219 $ hg bundle2
220 220 HG2X\x00\x00\x00\x00 (no-eol) (esc)
221 221
222 222 Test unbundling
223 223
224 224 $ hg bundle2 | hg statbundle2
225 225 options count: 0
226 226 parts count: 0
227 227
228 228 Test old style bundle are detected and refused
229 229
230 230 $ hg bundle --all ../bundle.hg
231 231 1 changesets found
232 232 $ hg statbundle2 < ../bundle.hg
233 233 abort: unknown bundle version 10
234 234 [255]
235 235
236 236 Test parameters
237 237 =================
238 238
239 239 - some options
240 240 - no parts
241 241
242 242 advisory parameters, no value
243 243 -------------------------------
244 244
245 245 Simplest possible parameters form
246 246
247 247 Test generation simple option
248 248
249 249 $ hg bundle2 --param 'caution'
250 250 HG2X\x00\x07caution\x00\x00 (no-eol) (esc)
251 251
252 252 Test unbundling
253 253
254 254 $ hg bundle2 --param 'caution' | hg statbundle2
255 255 options count: 1
256 256 - caution
257 257 parts count: 0
258 258
259 259 Test generation multiple option
260 260
261 261 $ hg bundle2 --param 'caution' --param 'meal'
262 262 HG2X\x00\x0ccaution meal\x00\x00 (no-eol) (esc)
263 263
264 264 Test unbundling
265 265
266 266 $ hg bundle2 --param 'caution' --param 'meal' | hg statbundle2
267 267 options count: 2
268 268 - caution
269 269 - meal
270 270 parts count: 0
271 271
272 272 advisory parameters, with value
273 273 -------------------------------
274 274
275 275 Test generation
276 276
277 277 $ hg bundle2 --param 'caution' --param 'meal=vegan' --param 'elephants'
278 278 HG2X\x00\x1ccaution meal=vegan elephants\x00\x00 (no-eol) (esc)
279 279
280 280 Test unbundling
281 281
282 282 $ hg bundle2 --param 'caution' --param 'meal=vegan' --param 'elephants' | hg statbundle2
283 283 options count: 3
284 284 - caution
285 285 - elephants
286 286 - meal
287 287 vegan
288 288 parts count: 0
289 289
290 290 parameter with special char in value
291 291 ---------------------------------------------------
292 292
293 293 Test generation
294 294
295 295 $ hg bundle2 --param 'e|! 7/=babar%#==tutu' --param simple
296 296 HG2X\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00 (no-eol) (esc)
297 297
298 298 Test unbundling
299 299
300 300 $ hg bundle2 --param 'e|! 7/=babar%#==tutu' --param simple | hg statbundle2
301 301 options count: 2
302 302 - e|! 7/
303 303 babar%#==tutu
304 304 - simple
305 305 parts count: 0
306 306
307 307 Test unknown mandatory option
308 308 ---------------------------------------------------
309 309
310 310 $ hg bundle2 --param 'Gravity' | hg statbundle2
311 311 abort: unknown parameters: Stream Parameter - Gravity
312 312 [255]
313 313
314 314 Test debug output
315 315 ---------------------------------------------------
316 316
317 317 bundling debug
318 318
319 319 $ hg bundle2 --debug --param 'e|! 7/=babar%#==tutu' --param simple ../out.hg2
320 320 start emission of HG2X stream
321 321 bundle parameter: e%7C%21%207/=babar%25%23%3D%3Dtutu simple
322 322 start of parts
323 323 end of bundle
324 324
325 325 file content is ok
326 326
327 327 $ cat ../out.hg2
328 328 HG2X\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00 (no-eol) (esc)
329 329
330 330 unbundling debug
331 331
332 332 $ hg statbundle2 --debug < ../out.hg2
333 333 start processing of HG2X stream
334 334 reading bundle2 stream parameters
335 335 ignoring unknown parameter 'e|! 7/'
336 336 ignoring unknown parameter 'simple'
337 337 options count: 2
338 338 - e|! 7/
339 339 babar%#==tutu
340 340 - simple
341 341 start extraction of bundle2 parts
342 342 part header size: 0
343 343 end of bundle2 stream
344 344 parts count: 0
345 345
346 346
347 347 Test buggy input
348 348 ---------------------------------------------------
349 349
350 350 empty parameter name
351 351
352 352 $ hg bundle2 --param '' --quiet
353 353 abort: empty parameter name
354 354 [255]
355 355
356 356 bad parameter name
357 357
358 358 $ hg bundle2 --param 42babar
359 359 abort: non letter first character: '42babar'
360 360 [255]
361 361
362 362
363 363 Test part
364 364 =================
365 365
366 366 $ hg bundle2 --parts ../parts.hg2 --debug
367 367 start emission of HG2X stream
368 368 bundle parameter:
369 369 start of parts
370 370 bundle part: "test:empty"
371 371 bundle part: "test:empty"
372 372 bundle part: "test:song"
373 373 bundle part: "test:debugreply"
374 374 bundle part: "test:math"
375 375 bundle part: "test:song"
376 376 bundle part: "test:ping"
377 377 end of bundle
378 378
379 379 $ cat ../parts.hg2
380 380 HG2X\x00\x00\x00\x11 (esc)
381 381 test:empty\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11 (esc)
382 382 test:empty\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x10 test:song\x00\x00\x00\x02\x00\x00\x00\x00\x00\xb2Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko (esc)
383 383 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
384 384 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.\x00\x00\x00\x00\x00\x16\x0ftest:debugreply\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00+ test:math\x00\x00\x00\x04\x02\x01\x02\x04\x01\x04\x07\x03pi3.14e2.72cookingraw\x00\x00\x00\x0242\x00\x00\x00\x00\x00\x1d test:song\x00\x00\x00\x05\x01\x00\x0b\x00randomparam\x00\x00\x00\x00\x00\x10 test:ping\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
385 385
386 386
387 387 $ hg statbundle2 < ../parts.hg2
388 388 options count: 0
389 389 :test:empty:
390 390 mandatory: 0
391 391 advisory: 0
392 392 payload: 0 bytes
393 393 :test:empty:
394 394 mandatory: 0
395 395 advisory: 0
396 396 payload: 0 bytes
397 397 :test:song:
398 398 mandatory: 0
399 399 advisory: 0
400 400 payload: 178 bytes
401 401 :test:debugreply:
402 402 mandatory: 0
403 403 advisory: 0
404 404 payload: 0 bytes
405 405 :test:math:
406 406 mandatory: 2
407 407 advisory: 1
408 408 payload: 2 bytes
409 409 :test:song:
410 410 mandatory: 1
411 411 advisory: 0
412 412 payload: 0 bytes
413 413 :test:ping:
414 414 mandatory: 0
415 415 advisory: 0
416 416 payload: 0 bytes
417 417 parts count: 7
418 418
419 419 $ hg statbundle2 --debug < ../parts.hg2
420 420 start processing of HG2X stream
421 421 reading bundle2 stream parameters
422 422 options count: 0
423 423 start extraction of bundle2 parts
424 424 part header size: 17
425 425 part type: "test:empty"
426 426 part id: "0"
427 427 part parameters: 0
428 428 :test:empty:
429 429 mandatory: 0
430 430 advisory: 0
431 431 payload chunk size: 0
432 432 payload: 0 bytes
433 433 part header size: 17
434 434 part type: "test:empty"
435 435 part id: "1"
436 436 part parameters: 0
437 437 :test:empty:
438 438 mandatory: 0
439 439 advisory: 0
440 440 payload chunk size: 0
441 441 payload: 0 bytes
442 442 part header size: 16
443 443 part type: "test:song"
444 444 part id: "2"
445 445 part parameters: 0
446 446 :test:song:
447 447 mandatory: 0
448 448 advisory: 0
449 449 payload chunk size: 178
450 450 payload chunk size: 0
451 451 payload: 178 bytes
452 452 part header size: 22
453 453 part type: "test:debugreply"
454 454 part id: "3"
455 455 part parameters: 0
456 456 :test:debugreply:
457 457 mandatory: 0
458 458 advisory: 0
459 459 payload chunk size: 0
460 460 payload: 0 bytes
461 461 part header size: 43
462 462 part type: "test:math"
463 463 part id: "4"
464 464 part parameters: 3
465 465 :test:math:
466 466 mandatory: 2
467 467 advisory: 1
468 468 payload chunk size: 2
469 469 payload chunk size: 0
470 470 payload: 2 bytes
471 471 part header size: 29
472 472 part type: "test:song"
473 473 part id: "5"
474 474 part parameters: 1
475 475 :test:song:
476 476 mandatory: 1
477 477 advisory: 0
478 478 payload chunk size: 0
479 479 payload: 0 bytes
480 480 part header size: 16
481 481 part type: "test:ping"
482 482 part id: "6"
483 483 part parameters: 0
484 484 :test:ping:
485 485 mandatory: 0
486 486 advisory: 0
487 487 payload chunk size: 0
488 488 payload: 0 bytes
489 489 part header size: 0
490 490 end of bundle2 stream
491 491 parts count: 7
492 492
493 493 Test actual unbundling of test part
494 494 =======================================
495 495
496 496 Process the bundle
497 497
498 498 $ hg unbundle2 --debug < ../parts.hg2
499 499 start processing of HG2X stream
500 500 reading bundle2 stream parameters
501 501 start extraction of bundle2 parts
502 502 part header size: 17
503 503 part type: "test:empty"
504 504 part id: "0"
505 505 part parameters: 0
506 506 ignoring unsupported advisory part test:empty
507 507 payload chunk size: 0
508 508 part header size: 17
509 509 part type: "test:empty"
510 510 part id: "1"
511 511 part parameters: 0
512 512 ignoring unsupported advisory part test:empty
513 513 payload chunk size: 0
514 514 part header size: 16
515 515 part type: "test:song"
516 516 part id: "2"
517 517 part parameters: 0
518 518 found a handler for part 'test:song'
519 519 The choir starts singing:
520 520 payload chunk size: 178
521 521 payload chunk size: 0
522 522 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
523 523 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
524 524 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
525 525 part header size: 22
526 526 part type: "test:debugreply"
527 527 part id: "3"
528 528 part parameters: 0
529 529 found a handler for part 'test:debugreply'
530 530 debugreply: no reply
531 531 payload chunk size: 0
532 532 part header size: 43
533 533 part type: "test:math"
534 534 part id: "4"
535 535 part parameters: 3
536 536 ignoring unsupported advisory part test:math
537 537 payload chunk size: 2
538 538 payload chunk size: 0
539 539 part header size: 29
540 540 part type: "test:song"
541 541 part id: "5"
542 542 part parameters: 1
543 543 found a handler for part 'test:song'
544 544 ignoring unsupported advisory part test:song - randomparam
545 545 payload chunk size: 0
546 546 part header size: 16
547 547 part type: "test:ping"
548 548 part id: "6"
549 549 part parameters: 0
550 550 found a handler for part 'test:ping'
551 551 received ping request (id 6)
552 552 payload chunk size: 0
553 553 part header size: 0
554 554 end of bundle2 stream
555 555 0 unread bytes
556 556 3 total verses sung
557 557
558 558 Unbundle with an unknown mandatory part
559 559 (should abort)
560 560
561 561 $ hg bundle2 --parts --unknown ../unknown.hg2
562 562
563 563 $ hg unbundle2 < ../unknown.hg2
564 564 The choir starts singing:
565 565 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
566 566 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
567 567 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
568 568 debugreply: no reply
569 569 0 unread bytes
570 570 abort: missing support for test:unknown
571 571 [255]
572 572
573 573 Unbundle with an unknown mandatory part parameters
574 574 (should abort)
575 575
576 576 $ hg bundle2 --unknownparams ../unknown.hg2
577 577
578 578 $ hg unbundle2 < ../unknown.hg2
579 579 0 unread bytes
580 580 abort: missing support for test:song - randomparams
581 581 [255]
582 582
583 583 unbundle with a reply
584 584
585 585 $ hg bundle2 --parts --reply ../parts-reply.hg2
586 586 $ hg unbundle2 ../reply.hg2 < ../parts-reply.hg2
587 587 0 unread bytes
588 588 3 total verses sung
589 589
590 590 The reply is a bundle
591 591
592 592 $ cat ../reply.hg2
593 593 HG2X\x00\x00\x00\x1f (esc)
594 594 b2x:output\x00\x00\x00\x00\x00\x01\x0b\x01in-reply-to3\x00\x00\x00\xd9The choir starts singing: (esc)
595 595 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
596 596 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
597 597 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
598 598 \x00\x00\x00\x00\x00\x1f (esc)
599 599 b2x:output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to4\x00\x00\x00\xc9debugreply: capabilities: (esc)
600 600 debugreply: 'city=!'
601 601 debugreply: 'celeste,ville'
602 602 debugreply: 'elephants'
603 603 debugreply: 'babar'
604 604 debugreply: 'celeste'
605 605 debugreply: 'ping-pong'
606 606 \x00\x00\x00\x00\x00\x1e test:pong\x00\x00\x00\x02\x01\x00\x0b\x01in-reply-to7\x00\x00\x00\x00\x00\x1f (esc)
607 607 b2x:output\x00\x00\x00\x03\x00\x01\x0b\x01in-reply-to7\x00\x00\x00=received ping request (id 7) (esc)
608 608 replying to ping request (id 7)
609 609 \x00\x00\x00\x00\x00\x00 (no-eol) (esc)
610 610
611 611 The reply is valid
612 612
613 613 $ hg statbundle2 < ../reply.hg2
614 614 options count: 0
615 615 :b2x:output:
616 616 mandatory: 0
617 617 advisory: 1
618 618 payload: 217 bytes
619 619 :b2x:output:
620 620 mandatory: 0
621 621 advisory: 1
622 622 payload: 201 bytes
623 623 :test:pong:
624 624 mandatory: 1
625 625 advisory: 0
626 626 payload: 0 bytes
627 627 :b2x:output:
628 628 mandatory: 0
629 629 advisory: 1
630 630 payload: 61 bytes
631 631 parts count: 4
632 632
633 633 Unbundle the reply to get the output:
634 634
635 635 $ hg unbundle2 < ../reply.hg2
636 636 remote: The choir starts singing:
637 637 remote: Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
638 638 remote: Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
639 639 remote: Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
640 640 remote: debugreply: capabilities:
641 641 remote: debugreply: 'city=!'
642 642 remote: debugreply: 'celeste,ville'
643 643 remote: debugreply: 'elephants'
644 644 remote: debugreply: 'babar'
645 645 remote: debugreply: 'celeste'
646 646 remote: debugreply: 'ping-pong'
647 647 remote: received ping request (id 7)
648 648 remote: replying to ping request (id 7)
649 649 0 unread bytes
650 650
651 651 Test push race detection
652 652
653 653 $ hg bundle2 --pushrace ../part-race.hg2
654 654
655 655 $ hg unbundle2 < ../part-race.hg2
656 656 0 unread bytes
657 657 abort: push race: repository changed while pushing - please try again
658 658 [255]
659 659
660 660 Support for changegroup
661 661 ===================================
662 662
663 663 $ hg unbundle $TESTDIR/bundles/rebase.hg
664 664 adding changesets
665 665 adding manifests
666 666 adding file changes
667 667 added 8 changesets with 7 changes to 7 files (+3 heads)
668 668 (run 'hg heads' to see heads, 'hg merge' to merge)
669 669
670 670 $ hg log -G
671 o 8:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> H
671 o 8:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> H
672 672 |
673 | o 7:eea13746799a draft Nicolas Dumazet <nicdumz.commits@gmail.com> G
673 | o 7:eea13746799a draft Nicolas Dumazet <nicdumz.commits@gmail.com> G
674 674 |/|
675 o | 6:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F
675 o | 6:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F
676 676 | |
677 | o 5:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
677 | o 5:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
678 678 |/
679 | o 4:32af7686d403 draft Nicolas Dumazet <nicdumz.commits@gmail.com> D
679 | o 4:32af7686d403 draft Nicolas Dumazet <nicdumz.commits@gmail.com> D
680 680 | |
681 | o 3:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> C
681 | o 3:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> C
682 682 | |
683 | o 2:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> B
683 | o 2:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> B
684 684 |/
685 o 1:cd010b8cd998 draft Nicolas Dumazet <nicdumz.commits@gmail.com> A
685 o 1:cd010b8cd998 draft Nicolas Dumazet <nicdumz.commits@gmail.com> A
686 686
687 @ 0:3903775176ed draft test a
687 @ 0:3903775176ed draft test a
688 688
689 689
690 690 $ hg bundle2 --debug --rev '8+7+5+4' ../rev.hg2
691 691 4 changesets found
692 692 list of changesets:
693 693 32af7686d403cf45b5d95f2d70cebea587ac806a
694 694 9520eea781bcca16c1e15acc0ba14335a0e8e5ba
695 695 eea13746799a9e0bfd88f29d3c2e9dc9389f524f
696 696 02de42196ebee42ef284b6780a87cdc96e8eaab6
697 697 start emission of HG2X stream
698 698 bundle parameter:
699 699 start of parts
700 700 bundle part: "b2x:changegroup"
701 701 bundling: 1/4 changesets (25.00%)
702 702 bundling: 2/4 changesets (50.00%)
703 703 bundling: 3/4 changesets (75.00%)
704 704 bundling: 4/4 changesets (100.00%)
705 705 bundling: 1/4 manifests (25.00%)
706 706 bundling: 2/4 manifests (50.00%)
707 707 bundling: 3/4 manifests (75.00%)
708 708 bundling: 4/4 manifests (100.00%)
709 709 bundling: D 1/3 files (33.33%)
710 710 bundling: E 2/3 files (66.67%)
711 711 bundling: H 3/3 files (100.00%)
712 712 end of bundle
713 713
714 714 $ cat ../rev.hg2
715 715 HG2X\x00\x00\x00\x16\x0fb2x:changegroup\x00\x00\x00\x00\x00\x00\x00\x00\x06\x13\x00\x00\x00\xa42\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j_\xdd\xd9\x89W\xc8\xa5JMCm\xfe\x1d\xa9\xd8\x7f!\xa1\xb9{\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c (esc)
716 716 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02D (esc)
717 717 \x00\x00\x00i\x00\x00\x00j\x00\x00\x00\x01D\x00\x00\x00\xa4\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\xcd\x01\x0b\x8c\xd9\x98\xf3\x98\x1aZ\x81\x15\xf9O\x8d\xa4\xabP`\x89\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)4dece9c826f69490507b98c6383a3009b295837d (esc)
718 718 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02E (esc)
719 719 \x00\x00\x00i\x00\x00\x00j\x00\x00\x00\x01E\x00\x00\x00\xa2\xee\xa17Fy\x9a\x9e\x0b\xfd\x88\xf2\x9d<.\x9d\xc98\x9fRO$\xb68|\x8c\x8c\xae7\x17\x88\x80\xf3\xfa\x95\xde\xd3\xcb\x1c\xf7\x85\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\xee\xa17Fy\x9a\x9e\x0b\xfd\x88\xf2\x9d<.\x9d\xc98\x9fRO\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)365b93d57fdf4814e2b5911d6bacff2b12014441 (esc)
720 720 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x00\x00\x00\x00i\x00\x00\x00j\x00\x00\x00\x01G\x00\x00\x00\xa4\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc)
721 721 \x87\xcd\xc9n\x8e\xaa\xb6$\xb68|\x8c\x8c\xae7\x17\x88\x80\xf3\xfa\x95\xde\xd3\xcb\x1c\xf7\x85\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc)
722 722 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)8bee48edc7318541fc0013ee41b089276a8c24bf (esc)
723 723 \x00\x00\x00f\x00\x00\x00f\x00\x00\x00\x02H (esc)
724 724 \x00\x00\x00g\x00\x00\x00h\x00\x00\x00\x01H\x00\x00\x00\x00\x00\x00\x00\x8bn\x1fLG\xec\xb53\xff\xd0\xc8\xe5,\xdc\x88\xaf\xb6\xcd9\xe2\x0cf\xa5\xa0\x18\x17\xfd\xf5#\x9c'8\x02\xb5\xb7a\x8d\x05\x1c\x89\xe4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x81\x00\x00\x00\x81\x00\x00\x00+D\x00c3f1ca2924c16a19b0656a84900e504e5b0aec2d (esc)
725 725 \x00\x00\x00\x8bM\xec\xe9\xc8&\xf6\x94\x90P{\x98\xc68:0 \xb2\x95\x83}\x00}\x8c\x9d\x88\x84\x13%\xf5\xc6\xb0cq\xb3[N\x8a+\x1a\x83\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\x00\x00\x00+\x00\x00\x00\xac\x00\x00\x00+E\x009c6fd0350a6c0d0c49d4a9c5017cf07043f54e58 (esc)
726 726 \x00\x00\x00\x8b6[\x93\xd5\x7f\xdfH\x14\xe2\xb5\x91\x1dk\xac\xff+\x12\x01DA(\xa5\x84\xc6^\xf1!\xf8\x9e\xb6j\xb7\xd0\xbc\x15=\x80\x99\xe7\xceM\xec\xe9\xc8&\xf6\x94\x90P{\x98\xc68:0 \xb2\x95\x83}\xee\xa17Fy\x9a\x9e\x0b\xfd\x88\xf2\x9d<.\x9d\xc98\x9fRO\x00\x00\x00V\x00\x00\x00V\x00\x00\x00+F\x0022bfcfd62a21a3287edbd4d656218d0f525ed76a (esc)
727 727 \x00\x00\x00\x97\x8b\xeeH\xed\xc71\x85A\xfc\x00\x13\xeeA\xb0\x89'j\x8c$\xbf(\xa5\x84\xc6^\xf1!\xf8\x9e\xb6j\xb7\xd0\xbc\x15=\x80\x99\xe7\xce\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc)
728 728 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00+\x00\x00\x00V\x00\x00\x00\x00\x00\x00\x00\x81\x00\x00\x00\x81\x00\x00\x00+H\x008500189e74a9e0475e822093bc7db0d631aeb0b4 (esc)
729 729 \x00\x00\x00\x00\x00\x00\x00\x05D\x00\x00\x00b\xc3\xf1\xca)$\xc1j\x19\xb0ej\x84\x90\x0ePN[ (esc)
730 730 \xec-\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02D (esc)
731 731 \x00\x00\x00\x00\x00\x00\x00\x05E\x00\x00\x00b\x9co\xd05 (esc)
732 732 l\r (no-eol) (esc)
733 733 \x0cI\xd4\xa9\xc5\x01|\xf0pC\xf5NX\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02E (esc)
734 734 \x00\x00\x00\x00\x00\x00\x00\x05H\x00\x00\x00b\x85\x00\x18\x9et\xa9\xe0G^\x82 \x93\xbc}\xb0\xd61\xae\xb0\xb4\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc)
735 735 \x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02H (esc)
736 736 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
737 737
738 738 $ hg unbundle2 < ../rev.hg2
739 739 adding changesets
740 740 adding manifests
741 741 adding file changes
742 742 added 0 changesets with 0 changes to 3 files
743 743 0 unread bytes
744 744 addchangegroup return: 1
745 745
746 746 with reply
747 747
748 748 $ hg bundle2 --rev '8+7+5+4' --reply ../rev-rr.hg2
749 749 $ hg unbundle2 ../rev-reply.hg2 < ../rev-rr.hg2
750 750 0 unread bytes
751 751 addchangegroup return: 1
752 752
753 753 $ cat ../rev-reply.hg2
754 754 HG2X\x00\x00\x003\x15b2x:reply:changegroup\x00\x00\x00\x00\x00\x02\x0b\x01\x06\x01in-reply-to1return1\x00\x00\x00\x00\x00\x1f (esc)
755 755 b2x:output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to1\x00\x00\x00dadding changesets (esc)
756 756 adding manifests
757 757 adding file changes
758 758 added 0 changesets with 0 changes to 3 files
759 759 \x00\x00\x00\x00\x00\x00 (no-eol) (esc)
760 760
761 761 Real world exchange
762 762 =====================
763 763
764 764
765 765 clone --pull
766 766
767 767 $ cd ..
768 768 $ hg -R main phase --public cd010b8cd998
769 769 $ hg clone main other --pull --rev 9520eea781bc
770 770 adding changesets
771 771 adding manifests
772 772 adding file changes
773 773 added 2 changesets with 2 changes to 2 files
774 774 updating to branch default
775 775 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
776 776 $ hg -R other log -G
777 @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
777 @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
778 778 |
779 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
779 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
780 780
781 781
782 782 pull
783 783
784 784 $ hg -R main phase --public 9520eea781bc
785 785 $ hg -R other pull -r 24b6387c8c8c
786 786 pulling from $TESTTMP/main (glob)
787 787 searching for changes
788 788 adding changesets
789 789 adding manifests
790 790 adding file changes
791 791 added 1 changesets with 1 changes to 1 files (+1 heads)
792 792 (run 'hg heads' to see heads, 'hg merge' to merge)
793 793 $ hg -R other log -G
794 o 2:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F
794 o 2:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F
795 795 |
796 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
796 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
797 797 |/
798 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
798 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
799 799
800 800
801 801 pull empty (with phase movement)
802 802
803 803 $ hg -R main phase --public 24b6387c8c8c
804 804 $ hg -R other pull -r 24b6387c8c8c
805 805 pulling from $TESTTMP/main (glob)
806 806 no changes found
807 807 $ hg -R other log -G
808 o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
808 o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
809 809 |
810 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
810 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
811 811 |/
812 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
812 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
813 813
814 814 pull empty
815 815
816 816 $ hg -R other pull -r 24b6387c8c8c
817 817 pulling from $TESTTMP/main (glob)
818 818 no changes found
819 819 $ hg -R other log -G
820 o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
820 o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
821 821 |
822 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
822 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
823 823 |/
824 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
824 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
825 825
826 826
827 push
827 add extra data to test their exchange during push
828
829 $ hg -R main bookmark --rev eea13746799a book_eea1
830 $ hg -R main bookmark --rev 02de42196ebe book_02de
831 $ hg -R main bookmark --rev 42ccdea3bb16 book_42cc
832 $ hg -R main bookmark --rev 5fddd98957c8 book_5fdd
833 $ hg -R main bookmark --rev 32af7686d403 book_32af
834
835 $ hg -R other bookmark --rev cd010b8cd998 book_eea1
836 $ hg -R other bookmark --rev cd010b8cd998 book_02de
837 $ hg -R other bookmark --rev cd010b8cd998 book_42cc
838 $ hg -R other bookmark --rev cd010b8cd998 book_5fdd
839 $ hg -R other bookmark --rev cd010b8cd998 book_32af
828 840
829 841 $ hg -R main phase --public eea13746799a
830 $ hg -R main push other --rev eea13746799a
842
843 push
844 $ hg -R main push other --rev eea13746799a --bookmark book_eea1
831 845 pushing to other
832 846 searching for changes
833 847 remote: adding changesets
834 848 remote: adding manifests
835 849 remote: adding file changes
836 850 remote: added 1 changesets with 0 changes to 0 files (-1 heads)
851 updating bookmark book_eea1
852 exporting bookmark book_eea1
837 853 $ hg -R other log -G
838 o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G
854 o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
839 855 |\
840 | o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
856 | o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
841 857 | |
842 @ | 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
858 @ | 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
843 859 |/
844 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
860 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de book_32af book_42cc book_5fdd A
845 861
846 862
847 863 pull over ssh
848 864
849 $ hg -R other pull ssh://user@dummy/main -r 02de42196ebe --traceback
865 $ hg -R other pull ssh://user@dummy/main -r 02de42196ebe --bookmark book_02de
850 866 pulling from ssh://user@dummy/main
851 867 searching for changes
852 868 adding changesets
853 869 adding manifests
854 870 adding file changes
855 871 added 1 changesets with 1 changes to 1 files (+1 heads)
872 updating bookmark book_02de
856 873 (run 'hg heads' to see heads, 'hg merge' to merge)
874 importing bookmark book_02de
857 875
858 876 pull over http
859 877
860 878 $ hg -R main serve -p $HGPORT -d --pid-file=main.pid -E main-error.log
861 879 $ cat main.pid >> $DAEMON_PIDS
862 880
863 $ hg -R other pull http://localhost:$HGPORT/ -r 42ccdea3bb16
881 $ hg -R other pull http://localhost:$HGPORT/ -r 42ccdea3bb16 --bookmark book_42cc
864 882 pulling from http://localhost:$HGPORT/
865 883 searching for changes
866 884 adding changesets
867 885 adding manifests
868 886 adding file changes
869 887 added 1 changesets with 1 changes to 1 files (+1 heads)
888 updating bookmark book_42cc
870 889 (run 'hg heads .' to see heads, 'hg merge' to merge)
890 importing bookmark book_42cc
871 891 $ cat main-error.log
872 892
873 893 push over ssh
874 894
875 $ hg -R main push ssh://user@dummy/other -r 5fddd98957c8
895 $ hg -R main push ssh://user@dummy/other -r 5fddd98957c8 --bookmark book_5fdd
876 896 pushing to ssh://user@dummy/other
877 897 searching for changes
878 898 remote: adding changesets
879 899 remote: adding manifests
880 900 remote: adding file changes
881 901 remote: added 1 changesets with 1 changes to 1 files
902 updating bookmark book_5fdd
903 exporting bookmark book_5fdd
882 904 $ hg -R other log -G
883 o 6:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> C
905 o 6:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C
884 906 |
885 o 5:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> B
907 o 5:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_42cc B
886 908 |
887 | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> H
909 | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de H
888 910 | |
889 | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G
911 | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
890 912 | |/|
891 | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
913 | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
892 914 |/ /
893 | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
915 | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
894 916 |/
895 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
917 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_32af A
896 918
897 919
898 920 push over http
899 921
900 922 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
901 923 $ cat other.pid >> $DAEMON_PIDS
902 924
903 925 $ hg -R main phase --public 32af7686d403
904 $ hg -R main push http://localhost:$HGPORT2/ -r 32af7686d403
926 $ hg -R main push http://localhost:$HGPORT2/ -r 32af7686d403 --bookmark book_32af
905 927 pushing to http://localhost:$HGPORT2/
906 928 searching for changes
907 929 remote: adding changesets
908 930 remote: adding manifests
909 931 remote: adding file changes
910 932 remote: added 1 changesets with 1 changes to 1 files
933 updating bookmark book_32af
934 exporting bookmark book_32af
911 935 $ cat other-error.log
912 936
913 937 Check final content.
914 938
915 939 $ hg -R other log -G
916 o 7:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D
940 o 7:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_32af D
917 941 |
918 o 6:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C
942 o 6:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C
919 943 |
920 o 5:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B
944 o 5:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_42cc B
921 945 |
922 | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> H
946 | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de H
923 947 | |
924 | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G
948 | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
925 949 | |/|
926 | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
950 | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
927 951 |/ /
928 | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
952 | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
929 953 |/
930 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
954 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
931 955
932 956
933 957 Error Handling
934 958 ==============
935 959
936 960 Check that errors are properly returned to the client during push.
937 961
938 962 Setting up
939 963
940 964 $ cat > failpush.py << EOF
941 965 > """A small extension that makes push fails when using bundle2
942 966 >
943 967 > used to test error handling in bundle2
944 968 > """
945 969 >
946 970 > from mercurial import util
947 971 > from mercurial import bundle2
948 972 > from mercurial import exchange
949 973 > from mercurial import extensions
950 974 >
951 975 > def _pushbundle2failpart(pushop, bundler):
952 976 > reason = pushop.ui.config('failpush', 'reason', None)
953 977 > part = None
954 978 > if reason == 'abort':
955 979 > bundler.newpart('test:abort')
956 980 > if reason == 'unknown':
957 981 > bundler.newpart('TEST:UNKNOWN')
958 982 > if reason == 'race':
959 983 > # 20 Bytes of crap
960 984 > bundler.newpart('b2x:check:heads', data='01234567890123456789')
961 985 >
962 986 > @bundle2.parthandler("test:abort")
963 987 > def handleabort(op, part):
964 988 > raise util.Abort('Abandon ship!', hint="don't panic")
965 989 >
966 990 > def uisetup(ui):
967 991 > exchange.b2partsgenmapping['failpart'] = _pushbundle2failpart
968 992 > exchange.b2partsgenorder.insert(0, 'failpart')
969 993 >
970 994 > EOF
971 995
972 996 $ cd main
973 997 $ hg up tip
974 998 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
975 999 $ echo 'I' > I
976 1000 $ hg add I
977 1001 $ hg ci -m 'I'
978 1002 $ hg id
979 1003 e7ec4e813ba6 tip
980 1004 $ cd ..
981 1005
982 1006 $ cat << EOF >> $HGRCPATH
983 1007 > [extensions]
984 1008 > failpush=$TESTTMP/failpush.py
985 1009 > EOF
986 1010
987 1011 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
988 1012 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
989 1013 $ cat other.pid >> $DAEMON_PIDS
990 1014
991 1015 Doing the actual push: Abort error
992 1016
993 1017 $ cat << EOF >> $HGRCPATH
994 1018 > [failpush]
995 1019 > reason = abort
996 1020 > EOF
997 1021
998 1022 $ hg -R main push other -r e7ec4e813ba6
999 1023 pushing to other
1000 1024 searching for changes
1001 1025 abort: Abandon ship!
1002 1026 (don't panic)
1003 1027 [255]
1004 1028
1005 1029 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
1006 1030 pushing to ssh://user@dummy/other
1007 1031 searching for changes
1008 1032 abort: Abandon ship!
1009 1033 (don't panic)
1010 1034 [255]
1011 1035
1012 1036 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
1013 1037 pushing to http://localhost:$HGPORT2/
1014 1038 searching for changes
1015 1039 abort: Abandon ship!
1016 1040 (don't panic)
1017 1041 [255]
1018 1042
1019 1043
1020 1044 Doing the actual push: unknown mandatory parts
1021 1045
1022 1046 $ cat << EOF >> $HGRCPATH
1023 1047 > [failpush]
1024 1048 > reason = unknown
1025 1049 > EOF
1026 1050
1027 1051 $ hg -R main push other -r e7ec4e813ba6
1028 1052 pushing to other
1029 1053 searching for changes
1030 1054 abort: missing support for test:unknown
1031 1055 [255]
1032 1056
1033 1057 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
1034 1058 pushing to ssh://user@dummy/other
1035 1059 searching for changes
1036 1060 abort: missing support for test:unknown
1037 1061 [255]
1038 1062
1039 1063 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
1040 1064 pushing to http://localhost:$HGPORT2/
1041 1065 searching for changes
1042 1066 abort: missing support for test:unknown
1043 1067 [255]
1044 1068
1045 1069 Doing the actual push: race
1046 1070
1047 1071 $ cat << EOF >> $HGRCPATH
1048 1072 > [failpush]
1049 1073 > reason = race
1050 1074 > EOF
1051 1075
1052 1076 $ hg -R main push other -r e7ec4e813ba6
1053 1077 pushing to other
1054 1078 searching for changes
1055 1079 abort: push failed:
1056 1080 'repository changed while pushing - please try again'
1057 1081 [255]
1058 1082
1059 1083 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
1060 1084 pushing to ssh://user@dummy/other
1061 1085 searching for changes
1062 1086 abort: push failed:
1063 1087 'repository changed while pushing - please try again'
1064 1088 [255]
1065 1089
1066 1090 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
1067 1091 pushing to http://localhost:$HGPORT2/
1068 1092 searching for changes
1069 1093 abort: push failed:
1070 1094 'repository changed while pushing - please try again'
1071 1095 [255]
1072 1096
1073 1097 Doing the actual push: hook abort
1074 1098
1075 1099 $ cat << EOF >> $HGRCPATH
1076 1100 > [failpush]
1077 1101 > reason =
1078 1102 > [hooks]
1079 1103 > b2x-pretransactionclose.failpush = false
1080 1104 > EOF
1081 1105
1082 1106 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
1083 1107 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
1084 1108 $ cat other.pid >> $DAEMON_PIDS
1085 1109
1086 1110 $ hg -R main push other -r e7ec4e813ba6
1087 1111 pushing to other
1088 1112 searching for changes
1089 1113 transaction abort!
1090 1114 rollback completed
1091 1115 abort: b2x-pretransactionclose.failpush hook exited with status 1
1092 1116 [255]
1093 1117
1094 1118 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
1095 1119 pushing to ssh://user@dummy/other
1096 1120 searching for changes
1097 1121 abort: b2x-pretransactionclose.failpush hook exited with status 1
1098 1122 remote: transaction abort!
1099 1123 remote: rollback completed
1100 1124 [255]
1101 1125
1102 1126 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
1103 1127 pushing to http://localhost:$HGPORT2/
1104 1128 searching for changes
1105 1129 abort: b2x-pretransactionclose.failpush hook exited with status 1
1106 1130 [255]
1107 1131
1108 1132
General Comments 0
You need to be logged in to leave comments. Login now