Mercurial > hg
comparison mercurial/streamclone.py @ 38373:ef692614e601
progress: hide update(None) in a new complete() method
update(None) seemed a bit cryptic.
Differential Revision: https://phab.mercurial-scm.org/D3774
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sun, 17 Jun 2018 22:13:41 -0700 |
parents | c1fca51c26f3 |
children | 800f5a2c869e |
comparison
equal
deleted
inserted
replaced
38372:f4f1fb1cbfb4 | 38373:ef692614e601 |
---|---|
319 | 319 |
320 for chunk in it: | 320 for chunk in it: |
321 progress.increment(step=len(chunk)) | 321 progress.increment(step=len(chunk)) |
322 yield chunk | 322 yield chunk |
323 | 323 |
324 progress.update(None) | 324 progress.complete() |
325 | 325 |
326 return requirements, gen() | 326 return requirements, gen() |
327 | 327 |
328 def consumev1(repo, fp, filecount, bytecount): | 328 def consumev1(repo, fp, filecount, bytecount): |
329 """Apply the contents from version 1 of a streaming clone file handle. | 329 """Apply the contents from version 1 of a streaming clone file handle. |
382 repo.invalidate(clearfilecache=True) | 382 repo.invalidate(clearfilecache=True) |
383 | 383 |
384 elapsed = util.timer() - start | 384 elapsed = util.timer() - start |
385 if elapsed <= 0: | 385 if elapsed <= 0: |
386 elapsed = 0.001 | 386 elapsed = 0.001 |
387 progress.update(None) | 387 progress.complete() |
388 repo.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') % | 388 repo.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') % |
389 (util.bytecount(bytecount), elapsed, | 389 (util.bytecount(bytecount), elapsed, |
390 util.bytecount(bytecount / elapsed))) | 390 util.bytecount(bytecount / elapsed))) |
391 | 391 |
392 def readbundle1header(fp): | 392 def readbundle1header(fp): |
524 progress.update(seen) | 524 progress.update(seen) |
525 yield chunk | 525 yield chunk |
526 finally: | 526 finally: |
527 fp.close() | 527 fp.close() |
528 finally: | 528 finally: |
529 progress.update(None) | 529 progress.complete() |
530 | 530 |
531 def generatev2(repo): | 531 def generatev2(repo): |
532 """Emit content for version 2 of a streaming clone. | 532 """Emit content for version 2 of a streaming clone. |
533 | 533 |
534 the data stream consists the following entries: | 534 the data stream consists the following entries: |
622 if elapsed <= 0: | 622 if elapsed <= 0: |
623 elapsed = 0.001 | 623 elapsed = 0.001 |
624 repo.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') % | 624 repo.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') % |
625 (util.bytecount(progress.pos), elapsed, | 625 (util.bytecount(progress.pos), elapsed, |
626 util.bytecount(progress.pos / elapsed))) | 626 util.bytecount(progress.pos / elapsed))) |
627 progress.update(None) | 627 progress.complete() |
628 | 628 |
629 def applybundlev2(repo, fp, filecount, filesize, requirements): | 629 def applybundlev2(repo, fp, filecount, filesize, requirements): |
630 missingreqs = [r for r in requirements if r not in repo.supported] | 630 missingreqs = [r for r in requirements if r not in repo.supported] |
631 if missingreqs: | 631 if missingreqs: |
632 raise error.Abort(_('unable to apply stream clone: ' | 632 raise error.Abort(_('unable to apply stream clone: ' |