Show More
@@ -644,40 +644,39 b' def _emit2(repo, entries, totalfilesize)' | |||||
644 | totalbytecount = 0 |
|
644 | totalbytecount = 0 | |
645 |
|
645 | |||
646 | for src, name, ftype, data in entries: |
|
646 | for src, name, ftype, data in entries: | |
647 |
|
|
647 | if True: | |
648 | yield src |
|
648 | vfs = vfsmap[src] | |
649 | yield util.uvarintencode(len(name)) |
|
649 | yield src | |
650 | if ftype == _fileappend: |
|
650 | yield util.uvarintencode(len(name)) | |
651 |
f |
|
651 | if ftype == _fileappend: | |
652 |
|
|
652 | fp = vfs(name) | |
653 | elif ftype == _filefull: |
|
653 | size = data | |
654 | fp = open(data, b'rb') |
|
654 | elif ftype == _filefull: | |
655 | size = util.fstat(fp).st_size |
|
655 | fp = open(data, b'rb') | |
656 | bytecount = 0 |
|
656 | size = util.fstat(fp).st_size | |
657 | try: |
|
657 | bytecount = 0 | |
658 | yield util.uvarintencode(size) |
|
658 | try: | |
659 |
yield |
|
659 | yield util.uvarintencode(size) | |
660 |
|
|
660 | yield name | |
661 |
|
|
661 | if size <= 65536: | |
662 | else: |
|
662 | chunks = (fp.read(size),) | |
663 | chunks = util.filechunkiter(fp, limit=size) |
|
663 | else: | |
664 | for chunk in chunks: |
|
664 | chunks = util.filechunkiter(fp, limit=size) | |
665 |
|
|
665 | for chunk in chunks: | |
666 |
|
|
666 | bytecount += len(chunk) | |
667 |
|
|
667 | totalbytecount += len(chunk) | |
668 | yield chunk |
|
668 | progress.update(totalbytecount) | |
669 | if bytecount != size: |
|
669 | yield chunk | |
670 | # Would most likely be caused by a race due to `hg strip` or |
|
670 | if bytecount != size: | |
671 | # a revlog split |
|
671 | # Would most likely be caused by a race due to `hg | |
672 |
|
|
672 | # strip` or a revlog split | |
673 | _( |
|
673 | msg = _( | |
674 | b'clone could only read %d bytes from %s, but ' |
|
674 | b'clone could only read %d bytes from %s, but ' | |
675 | b'expected %d bytes' |
|
675 | b'expected %d bytes' | |
676 | ) |
|
676 | ) | |
677 | % (bytecount, name, size) |
|
677 | raise error.Abort(msg % (bytecount, name, size)) | |
678 |
|
|
678 | finally: | |
679 | finally: |
|
679 | fp.close() | |
680 | fp.close() |
|
|||
681 |
|
680 | |||
682 |
|
681 | |||
683 | def _test_sync_point_walk_1(repo): |
|
682 | def _test_sync_point_walk_1(repo): |
General Comments 0
You need to be logged in to leave comments.
Login now