Show More
@@ -313,16 +313,15 b" def generatebundlev1(repo, compression='" | |||||
313 | # This is where we'll add compression in the future. |
|
313 | # This is where we'll add compression in the future. | |
314 | assert compression == 'UN' |
|
314 | assert compression == 'UN' | |
315 |
|
315 | |||
316 | seen = 0 |
|
316 | progress = repo.ui.makeprogress(_('bundle'), total=bytecount, | |
317 | repo.ui.progress(_('bundle'), 0, total=bytecount, unit=_('bytes')) |
|
317 | unit=_('bytes')) | |
|
318 | progress.update(0) | |||
318 |
|
319 | |||
319 | for chunk in it: |
|
320 | for chunk in it: | |
320 |
|
|
321 | progress.increment(step=len(chunk)) | |
321 | repo.ui.progress(_('bundle'), seen, total=bytecount, |
|
|||
322 | unit=_('bytes')) |
|
|||
323 | yield chunk |
|
322 | yield chunk | |
324 |
|
323 | |||
325 |
|
|
324 | progress.update(None) | |
326 |
|
325 | |||
327 | return requirements, gen() |
|
326 | return requirements, gen() | |
328 |
|
327 | |||
@@ -338,8 +337,9 b' def consumev1(repo, fp, filecount, bytec' | |||||
338 | with repo.lock(): |
|
337 | with repo.lock(): | |
339 | repo.ui.status(_('%d files to transfer, %s of data\n') % |
|
338 | repo.ui.status(_('%d files to transfer, %s of data\n') % | |
340 | (filecount, util.bytecount(bytecount))) |
|
339 | (filecount, util.bytecount(bytecount))) | |
341 | handled_bytes = 0 |
|
340 | progress = repo.ui.makeprogress(_('clone'), total=bytecount, | |
342 | repo.ui.progress(_('clone'), 0, total=bytecount, unit=_('bytes')) |
|
341 | unit=_('bytes')) | |
|
342 | progress.update(0) | |||
343 | start = util.timer() |
|
343 | start = util.timer() | |
344 |
|
344 | |||
345 | # TODO: get rid of (potential) inconsistency |
|
345 | # TODO: get rid of (potential) inconsistency | |
@@ -374,9 +374,7 b' def consumev1(repo, fp, filecount, bytec' | |||||
374 | path = store.decodedir(name) |
|
374 | path = store.decodedir(name) | |
375 | with repo.svfs(path, 'w', backgroundclose=True) as ofp: |
|
375 | with repo.svfs(path, 'w', backgroundclose=True) as ofp: | |
376 | for chunk in util.filechunkiter(fp, limit=size): |
|
376 | for chunk in util.filechunkiter(fp, limit=size): | |
377 |
|
|
377 | progress.increment(step=len(chunk)) | |
378 | repo.ui.progress(_('clone'), handled_bytes, |
|
|||
379 | total=bytecount, unit=_('bytes')) |
|
|||
380 | ofp.write(chunk) |
|
378 | ofp.write(chunk) | |
381 |
|
379 | |||
382 | # force @filecache properties to be reloaded from |
|
380 | # force @filecache properties to be reloaded from | |
@@ -386,7 +384,7 b' def consumev1(repo, fp, filecount, bytec' | |||||
386 | elapsed = util.timer() - start |
|
384 | elapsed = util.timer() - start | |
387 | if elapsed <= 0: |
|
385 | if elapsed <= 0: | |
388 | elapsed = 0.001 |
|
386 | elapsed = 0.001 | |
389 |
|
|
387 | progress.update(None) | |
390 | repo.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') % |
|
388 | repo.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') % | |
391 | (util.bytecount(bytecount), elapsed, |
|
389 | (util.bytecount(bytecount), elapsed, | |
392 | util.bytecount(bytecount / elapsed))) |
|
390 | util.bytecount(bytecount / elapsed))) | |
@@ -494,8 +492,9 b' def _makemap(repo):' | |||||
494 | def _emit2(repo, entries, totalfilesize): |
|
492 | def _emit2(repo, entries, totalfilesize): | |
495 | """actually emit the stream bundle""" |
|
493 | """actually emit the stream bundle""" | |
496 | vfsmap = _makemap(repo) |
|
494 | vfsmap = _makemap(repo) | |
497 | progress = repo.ui.progress |
|
495 | progress = repo.ui.makeprogress(_('bundle'), total=totalfilesize, | |
498 | progress(_('bundle'), 0, total=totalfilesize, unit=_('bytes')) |
|
496 | unit=_('bytes')) | |
|
497 | progress.update(0) | |||
499 | with maketempcopies() as copy: |
|
498 | with maketempcopies() as copy: | |
500 | try: |
|
499 | try: | |
501 | # copy is delayed until we are in the try |
|
500 | # copy is delayed until we are in the try | |
@@ -522,13 +521,12 b' def _emit2(repo, entries, totalfilesize)' | |||||
522 | chunks = util.filechunkiter(fp, limit=size) |
|
521 | chunks = util.filechunkiter(fp, limit=size) | |
523 | for chunk in chunks: |
|
522 | for chunk in chunks: | |
524 | seen += len(chunk) |
|
523 | seen += len(chunk) | |
525 |
progress( |
|
524 | progress.update(seen) | |
526 | unit=_('bytes')) |
|
|||
527 | yield chunk |
|
525 | yield chunk | |
528 | finally: |
|
526 | finally: | |
529 | fp.close() |
|
527 | fp.close() | |
530 | finally: |
|
528 | finally: | |
531 |
progress( |
|
529 | progress.update(None) | |
532 |
|
530 | |||
533 | def generatev2(repo): |
|
531 | def generatev2(repo): | |
534 | """Emit content for version 2 of a streaming clone. |
|
532 | """Emit content for version 2 of a streaming clone. | |
@@ -589,10 +587,9 b' def consumev2(repo, fp, filecount, files' | |||||
589 | (filecount, util.bytecount(filesize))) |
|
587 | (filecount, util.bytecount(filesize))) | |
590 |
|
588 | |||
591 | start = util.timer() |
|
589 | start = util.timer() | |
592 | handledbytes = 0 |
|
590 | progress = repo.ui.makeprogress(_('clone'), total=filesize, | |
593 | progress = repo.ui.progress |
|
591 | unit=_('bytes')) | |
594 |
|
592 | progress.update(0) | ||
595 | progress(_('clone'), handledbytes, total=filesize, unit=_('bytes')) |
|
|||
596 |
|
593 | |||
597 | vfsmap = _makemap(repo) |
|
594 | vfsmap = _makemap(repo) | |
598 |
|
595 | |||
@@ -614,9 +611,7 b' def consumev2(repo, fp, filecount, files' | |||||
614 |
|
611 | |||
615 | with vfs(name, 'w') as ofp: |
|
612 | with vfs(name, 'w') as ofp: | |
616 | for chunk in util.filechunkiter(fp, limit=datalen): |
|
613 | for chunk in util.filechunkiter(fp, limit=datalen): | |
617 |
|
|
614 | progress.increment(step=len(chunk)) | |
618 | progress(_('clone'), handledbytes, total=filesize, |
|
|||
619 | unit=_('bytes')) |
|
|||
620 | ofp.write(chunk) |
|
615 | ofp.write(chunk) | |
621 |
|
616 | |||
622 | # force @filecache properties to be reloaded from |
|
617 | # force @filecache properties to be reloaded from | |
@@ -626,10 +621,10 b' def consumev2(repo, fp, filecount, files' | |||||
626 | elapsed = util.timer() - start |
|
621 | elapsed = util.timer() - start | |
627 | if elapsed <= 0: |
|
622 | if elapsed <= 0: | |
628 | elapsed = 0.001 |
|
623 | elapsed = 0.001 | |
629 |
progress( |
|
624 | progress.update(None) | |
630 | repo.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') % |
|
625 | repo.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') % | |
631 |
(util.bytecount( |
|
626 | (util.bytecount(progress.pos), elapsed, | |
632 |
util.bytecount( |
|
627 | util.bytecount(progress.pos / elapsed))) | |
633 |
|
628 | |||
634 | def applybundlev2(repo, fp, filecount, filesize, requirements): |
|
629 | def applybundlev2(repo, fp, filecount, filesize, requirements): | |
635 | 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] |
General Comments 0
You need to be logged in to leave comments.
Login now