Show More
@@ -583,7 +583,7 b' def _emit2(repo, entries, totalfilesize)' | |||||
583 | # copy is delayed until we are in the try |
|
583 | # copy is delayed until we are in the try | |
584 | entries = [_filterfull(e, copy, vfsmap) for e in entries] |
|
584 | entries = [_filterfull(e, copy, vfsmap) for e in entries] | |
585 | yield None # this release the lock on the repository |
|
585 | yield None # this release the lock on the repository | |
586 |
|
|
586 | totalbytecount = 0 | |
587 |
|
587 | |||
588 | for src, name, ftype, data in entries: |
|
588 | for src, name, ftype, data in entries: | |
589 | vfs = vfsmap[src] |
|
589 | vfs = vfsmap[src] | |
@@ -595,6 +595,7 b' def _emit2(repo, entries, totalfilesize)' | |||||
595 | elif ftype == _filefull: |
|
595 | elif ftype == _filefull: | |
596 | fp = open(data, b'rb') |
|
596 | fp = open(data, b'rb') | |
597 | size = util.fstat(fp).st_size |
|
597 | size = util.fstat(fp).st_size | |
|
598 | bytecount = 0 | |||
598 | try: |
|
599 | try: | |
599 | yield util.uvarintencode(size) |
|
600 | yield util.uvarintencode(size) | |
600 | yield name |
|
601 | yield name | |
@@ -603,9 +604,20 b' def _emit2(repo, entries, totalfilesize)' | |||||
603 | else: |
|
604 | else: | |
604 | chunks = util.filechunkiter(fp, limit=size) |
|
605 | chunks = util.filechunkiter(fp, limit=size) | |
605 | for chunk in chunks: |
|
606 | for chunk in chunks: | |
606 |
|
|
607 | bytecount += len(chunk) | |
607 |
|
|
608 | totalbytecount += len(chunk) | |
|
609 | progress.update(totalbytecount) | |||
608 | yield chunk |
|
610 | yield chunk | |
|
611 | if bytecount != size: | |||
|
612 | # Would most likely be caused by a race due to `hg strip` or | |||
|
613 | # a revlog split | |||
|
614 | raise error.Abort( | |||
|
615 | _( | |||
|
616 | b'clone could only read %d bytes from %s, but ' | |||
|
617 | b'expected %d bytes' | |||
|
618 | ) | |||
|
619 | % (bytecount, name, size) | |||
|
620 | ) | |||
609 | finally: |
|
621 | finally: | |
610 | fp.close() |
|
622 | fp.close() | |
611 |
|
623 |
General Comments 0
You need to be logged in to leave comments.
Login now