comparison tests/test-bundle2.t @ 21017:8de8187e6f48

bundle2: lazily iterate over bundle parts in the test We used to create a list to know the number of parts in the bundle. This prevents any lazy reading as planned for real usage. The list creation is dropped. Some test output changed as debug output is now interleaved with command output.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 11 Apr 2014 15:02:26 -0400
parents 3d38ebb586fe
children 3dc09f831a2e
comparison
equal deleted inserted replaced
21016:b477afb1c81e 21017:8de8187e6f48
144 > for key in sorted(params): 144 > for key in sorted(params):
145 > ui.write('- %s\n' % key) 145 > ui.write('- %s\n' % key)
146 > value = params[key] 146 > value = params[key]
147 > if value is not None: 147 > if value is not None:
148 > ui.write(' %s\n' % value) 148 > ui.write(' %s\n' % value)
149 > parts = list(unbundler) 149 > count = 0
150 > ui.write('parts count: %i\n' % len(parts)) 150 > for p in unbundler:
151 > for p in parts: 151 > count += 1
152 > ui.write(' :%s:\n' % p.type) 152 > ui.write(' :%s:\n' % p.type)
153 > ui.write(' mandatory: %i\n' % len(p.mandatoryparams)) 153 > ui.write(' mandatory: %i\n' % len(p.mandatoryparams))
154 > ui.write(' advisory: %i\n' % len(p.advisoryparams)) 154 > ui.write(' advisory: %i\n' % len(p.advisoryparams))
155 > ui.write(' payload: %i bytes\n' % len(p.data)) 155 > ui.write(' payload: %i bytes\n' % len(p.data))
156 > ui.write('parts count: %i\n' % count)
156 > EOF 157 > EOF
157 $ cat >> $HGRCPATH << EOF 158 $ cat >> $HGRCPATH << EOF
158 > [extensions] 159 > [extensions]
159 > bundle2=$TESTTMP/bundle2.py 160 > bundle2=$TESTTMP/bundle2.py
160 > [server] 161 > [server]
344 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.\x00\x00\x00\x00\x00+ test:math\x00\x00\x00\x03\x02\x01\x02\x04\x01\x04\x07\x03pi3.14e2.72cookingraw\x00\x00\x00\x0242\x00\x00\x00\x00\x00\x10 test:ping\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc) 345 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.\x00\x00\x00\x00\x00+ test:math\x00\x00\x00\x03\x02\x01\x02\x04\x01\x04\x07\x03pi3.14e2.72cookingraw\x00\x00\x00\x0242\x00\x00\x00\x00\x00\x10 test:ping\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
345 346
346 347
347 $ hg statbundle2 < ../parts.hg2 348 $ hg statbundle2 < ../parts.hg2
348 options count: 0 349 options count: 0
349 parts count: 5
350 :test:empty: 350 :test:empty:
351 mandatory: 0 351 mandatory: 0
352 advisory: 0 352 advisory: 0
353 payload: 0 bytes 353 payload: 0 bytes
354 :test:empty: 354 :test:empty:
365 payload: 2 bytes 365 payload: 2 bytes
366 :test:ping: 366 :test:ping:
367 mandatory: 0 367 mandatory: 0
368 advisory: 0 368 advisory: 0
369 payload: 0 bytes 369 payload: 0 bytes
370 parts count: 5
370 371
371 $ hg statbundle2 --debug < ../parts.hg2 372 $ hg statbundle2 --debug < ../parts.hg2
372 start processing of HG20 stream 373 start processing of HG20 stream
373 reading bundle2 stream parameters 374 reading bundle2 stream parameters
374 options count: 0 375 options count: 0
376 part header size: 17 377 part header size: 17
377 part type: "test:empty" 378 part type: "test:empty"
378 part id: "0" 379 part id: "0"
379 part parameters: 0 380 part parameters: 0
380 payload chunk size: 0 381 payload chunk size: 0
382 :test:empty:
383 mandatory: 0
384 advisory: 0
385 payload: 0 bytes
381 part header size: 17 386 part header size: 17
382 part type: "test:empty" 387 part type: "test:empty"
383 part id: "1" 388 part id: "1"
384 part parameters: 0 389 part parameters: 0
385 payload chunk size: 0 390 payload chunk size: 0
391 :test:empty:
392 mandatory: 0
393 advisory: 0
394 payload: 0 bytes
386 part header size: 16 395 part header size: 16
387 part type: "test:song" 396 part type: "test:song"
388 part id: "2" 397 part id: "2"
389 part parameters: 0 398 part parameters: 0
390 payload chunk size: 178 399 payload chunk size: 178
391 payload chunk size: 0 400 payload chunk size: 0
401 :test:song:
402 mandatory: 0
403 advisory: 0
404 payload: 178 bytes
392 part header size: 43 405 part header size: 43
393 part type: "test:math" 406 part type: "test:math"
394 part id: "3" 407 part id: "3"
395 part parameters: 3 408 part parameters: 3
396 payload chunk size: 2 409 payload chunk size: 2
397 payload chunk size: 0 410 payload chunk size: 0
398 part header size: 16
399 part type: "test:ping"
400 part id: "4"
401 part parameters: 0
402 payload chunk size: 0
403 part header size: 0
404 end of bundle2 stream
405 parts count: 5
406 :test:empty:
407 mandatory: 0
408 advisory: 0
409 payload: 0 bytes
410 :test:empty:
411 mandatory: 0
412 advisory: 0
413 payload: 0 bytes
414 :test:song:
415 mandatory: 0
416 advisory: 0
417 payload: 178 bytes
418 :test:math: 411 :test:math:
419 mandatory: 2 412 mandatory: 2
420 advisory: 1 413 advisory: 1
421 payload: 2 bytes 414 payload: 2 bytes
415 part header size: 16
416 part type: "test:ping"
417 part id: "4"
418 part parameters: 0
419 payload chunk size: 0
422 :test:ping: 420 :test:ping:
423 mandatory: 0 421 mandatory: 0
424 advisory: 0 422 advisory: 0
425 payload: 0 bytes 423 payload: 0 bytes
424 part header size: 0
425 end of bundle2 stream
426 parts count: 5
426 427
427 Test actual unbundling of test part 428 Test actual unbundling of test part
428 ======================================= 429 =======================================
429 430
430 Process the bundle 431 Process the bundle
507 508
508 The reply is valid 509 The reply is valid
509 510
510 $ hg statbundle2 < ../reply.hg2 511 $ hg statbundle2 < ../reply.hg2
511 options count: 0 512 options count: 0
512 parts count: 1
513 :test:pong: 513 :test:pong:
514 mandatory: 1 514 mandatory: 1
515 advisory: 0 515 advisory: 0
516 payload: 0 bytes 516 payload: 0 bytes
517 parts count: 1
517 518
518 Support for changegroup 519 Support for changegroup
519 =================================== 520 ===================================
520 521
521 $ hg unbundle $TESTDIR/bundles/rebase.hg 522 $ hg unbundle $TESTDIR/bundles/rebase.hg