Show More
@@ -827,6 +827,7 b' class unbundlepart(unpackermixin):' | |||
|
827 | 827 | self._payloadstream = None |
|
828 | 828 | self._readheader() |
|
829 | 829 | self._mandatory = None |
|
830 | self._chunkindex = [] #(payload, file) position tuples for chunk starts | |
|
830 | 831 | |
|
831 | 832 | def _fromheader(self, size): |
|
832 | 833 | """return the next <size> byte from the header""" |
@@ -852,7 +853,17 b' class unbundlepart(unpackermixin):' | |||
|
852 | 853 | self.params.update(dict(self.advisoryparams)) |
|
853 | 854 | self.mandatorykeys = frozenset(p[0] for p in mandatoryparams) |
|
854 | 855 | |
|
855 | def _payloadchunks(self): | |
|
856 | def _payloadchunks(self, chunknum=0): | |
|
857 | '''seek to specified chunk and start yielding data''' | |
|
858 | if len(self._chunkindex) == 0: | |
|
859 | assert chunknum == 0, 'Must start with chunk 0' | |
|
860 | self._chunkindex.append((0, super(unbundlepart, self).tell())) | |
|
861 | else: | |
|
862 | assert chunknum < len(self._chunkindex), \ | |
|
863 | 'Unknown chunk %d' % chunknum | |
|
864 | super(unbundlepart, self).seek(self._chunkindex[chunknum][1]) | |
|
865 | ||
|
866 | pos = self._chunkindex[chunknum][0] | |
|
856 | 867 | payloadsize = self._unpack(_fpayloadsize)[0] |
|
857 | 868 | self.ui.debug('payload chunk size: %i\n' % payloadsize) |
|
858 | 869 | while payloadsize: |
@@ -864,7 +875,13 b' class unbundlepart(unpackermixin):' | |||
|
864 | 875 | msg = 'negative payload chunk size: %i' % payloadsize |
|
865 | 876 | raise error.BundleValueError(msg) |
|
866 | 877 | else: |
|
867 |
|
|
|
878 | result = self._readexact(payloadsize) | |
|
879 | chunknum += 1 | |
|
880 | pos += payloadsize | |
|
881 | if chunknum == len(self._chunkindex): | |
|
882 | self._chunkindex.append((pos, | |
|
883 | super(unbundlepart, self).tell())) | |
|
884 | yield result | |
|
868 | 885 | payloadsize = self._unpack(_fpayloadsize)[0] |
|
869 | 886 | self.ui.debug('payload chunk size: %i\n' % payloadsize) |
|
870 | 887 |
General Comments 0
You need to be logged in to leave comments.
Login now