Show More
@@ -1293,6 +1293,12 b' class progress(object):' | |||||
1293 | self.unit = unit |
|
1293 | self.unit = unit | |
1294 | self.total = total |
|
1294 | self.total = total | |
1295 |
|
1295 | |||
|
1296 | def __enter__(self): | |||
|
1297 | pass | |||
|
1298 | ||||
|
1299 | def __exit__(self, exc_type, exc_value, exc_tb): | |||
|
1300 | self.complete() | |||
|
1301 | ||||
1296 | def update(self, pos, item="", total=None): |
|
1302 | def update(self, pos, item="", total=None): | |
1297 | if total: |
|
1303 | if total: | |
1298 | self.total = total |
|
1304 | self.total = total |
@@ -495,38 +495,35 b' def _emit2(repo, entries, totalfilesize)' | |||||
495 | progress = repo.ui.makeprogress(_('bundle'), total=totalfilesize, |
|
495 | progress = repo.ui.makeprogress(_('bundle'), total=totalfilesize, | |
496 | unit=_('bytes')) |
|
496 | unit=_('bytes')) | |
497 | progress.update(0) |
|
497 | progress.update(0) | |
498 | with maketempcopies() as copy: |
|
498 | with maketempcopies() as copy, progress: | |
499 | try: |
|
499 | # copy is delayed until we are in the try | |
500 | # copy is delayed until we are in the try |
|
500 | entries = [_filterfull(e, copy, vfsmap) for e in entries] | |
501 | entries = [_filterfull(e, copy, vfsmap) for e in entries] |
|
501 | yield None # this release the lock on the repository | |
502 | yield None # this release the lock on the repository |
|
502 | seen = 0 | |
503 | seen = 0 |
|
|||
504 |
|
503 | |||
505 |
|
|
504 | for src, name, ftype, data in entries: | |
506 |
|
|
505 | vfs = vfsmap[src] | |
507 |
|
|
506 | yield src | |
508 |
|
|
507 | yield util.uvarintencode(len(name)) | |
509 |
|
|
508 | if ftype == _fileappend: | |
510 |
|
|
509 | fp = vfs(name) | |
511 |
|
|
510 | size = data | |
512 |
|
|
511 | elif ftype == _filefull: | |
513 |
|
|
512 | fp = open(data, 'rb') | |
514 |
|
|
513 | size = util.fstat(fp).st_size | |
515 |
|
|
514 | try: | |
516 |
|
|
515 | yield util.uvarintencode(size) | |
517 |
|
|
516 | yield name | |
518 |
|
|
517 | if size <= 65536: | |
519 |
|
|
518 | chunks = (fp.read(size),) | |
520 |
|
|
519 | else: | |
521 |
|
|
520 | chunks = util.filechunkiter(fp, limit=size) | |
522 |
|
|
521 | for chunk in chunks: | |
523 |
|
|
522 | seen += len(chunk) | |
524 |
|
|
523 | progress.update(seen) | |
525 |
|
|
524 | yield chunk | |
526 |
|
|
525 | finally: | |
527 |
|
|
526 | fp.close() | |
528 | finally: |
|
|||
529 | progress.complete() |
|
|||
530 |
|
527 | |||
531 | def generatev2(repo): |
|
528 | def generatev2(repo): | |
532 | """Emit content for version 2 of a streaming clone. |
|
529 | """Emit content for version 2 of a streaming clone. |
General Comments 0
You need to be logged in to leave comments.
Login now