Show More
@@ -546,8 +546,12 b' def perfbundleread(ui, repo, bundlepath,' | |||||
546 | for part in bundle.iterparts(): |
|
546 | for part in bundle.iterparts(): | |
547 | pass |
|
547 | pass | |
548 |
|
548 | |||
|
549 | def iterpartsseekable(bundle): | |||
|
550 | for part in bundle.iterparts(seekable=True): | |||
|
551 | pass | |||
|
552 | ||||
549 | def seek(bundle): |
|
553 | def seek(bundle): | |
550 | for part in bundle.iterparts(): |
|
554 | for part in bundle.iterparts(seekable=True): | |
551 | part.seek(0, os.SEEK_END) |
|
555 | part.seek(0, os.SEEK_END) | |
552 |
|
556 | |||
553 | def makepartreadnbytes(size): |
|
557 | def makepartreadnbytes(size): | |
@@ -583,6 +587,7 b' def perfbundleread(ui, repo, bundlepath,' | |||||
583 | benches.extend([ |
|
587 | benches.extend([ | |
584 | (makebench(forwardchunks), 'bundle2 forwardchunks()'), |
|
588 | (makebench(forwardchunks), 'bundle2 forwardchunks()'), | |
585 | (makebench(iterparts), 'bundle2 iterparts()'), |
|
589 | (makebench(iterparts), 'bundle2 iterparts()'), | |
|
590 | (makebench(iterpartsseekable), 'bundle2 iterparts() seekable'), | |||
586 | (makebench(seek), 'bundle2 part seek()'), |
|
591 | (makebench(seek), 'bundle2 part seek()'), | |
587 | (makepartreadnbytes(8192), 'bundle2 part read(8k)'), |
|
592 | (makepartreadnbytes(8192), 'bundle2 part read(8k)'), | |
588 | (makepartreadnbytes(16384), 'bundle2 part read(16k)'), |
|
593 | (makepartreadnbytes(16384), 'bundle2 part read(16k)'), |
@@ -845,8 +845,9 b' class unbundle20(unpackermixin):' | |||||
845 | yield self._readexact(size) |
|
845 | yield self._readexact(size) | |
846 |
|
846 | |||
847 |
|
847 | |||
848 | def iterparts(self): |
|
848 | def iterparts(self, seekable=False): | |
849 | """yield all parts contained in the stream""" |
|
849 | """yield all parts contained in the stream""" | |
|
850 | cls = seekableunbundlepart if seekable else unbundlepart | |||
850 | # make sure param have been loaded |
|
851 | # make sure param have been loaded | |
851 | self.params |
|
852 | self.params | |
852 | # From there, payload need to be decompressed |
|
853 | # From there, payload need to be decompressed | |
@@ -854,7 +855,7 b' class unbundle20(unpackermixin):' | |||||
854 | indebug(self.ui, 'start extraction of bundle2 parts') |
|
855 | indebug(self.ui, 'start extraction of bundle2 parts') | |
855 | headerblock = self._readpartheader() |
|
856 | headerblock = self._readpartheader() | |
856 | while headerblock is not None: |
|
857 | while headerblock is not None: | |
857 |
part = s |
|
858 | part = cls(self.ui, headerblock, self._fp) | |
858 | yield part |
|
859 | yield part | |
859 | # Ensure part is fully consumed so we can start reading the next |
|
860 | # Ensure part is fully consumed so we can start reading the next | |
860 | # part. |
|
861 | # part. | |
@@ -1154,7 +1155,7 b' class interrupthandler(unpackermixin):' | |||||
1154 | if headerblock is None: |
|
1155 | if headerblock is None: | |
1155 | indebug(self.ui, 'no part found during interruption.') |
|
1156 | indebug(self.ui, 'no part found during interruption.') | |
1156 | return |
|
1157 | return | |
1157 |
part = |
|
1158 | part = unbundlepart(self.ui, headerblock, self._fp) | |
1158 | op = interruptoperation(self.ui) |
|
1159 | op = interruptoperation(self.ui) | |
1159 | hardabort = False |
|
1160 | hardabort = False | |
1160 | try: |
|
1161 | try: |
@@ -289,7 +289,7 b' class bundlerepository(localrepo.localre' | |||||
289 | self._cgunpacker = None |
|
289 | self._cgunpacker = None | |
290 |
|
290 | |||
291 | cgpart = None |
|
291 | cgpart = None | |
292 | for part in bundle.iterparts(): |
|
292 | for part in bundle.iterparts(seekable=True): | |
293 | if part.type == 'changegroup': |
|
293 | if part.type == 'changegroup': | |
294 | if cgpart: |
|
294 | if cgpart: | |
295 | raise NotImplementedError("can't process " |
|
295 | raise NotImplementedError("can't process " |
General Comments 0
You need to be logged in to leave comments.
Login now