Show More
@@ -179,7 +179,7 b' def outdebug(ui, message):' | |||||
179 |
|
179 | |||
180 | def indebug(ui, message): |
|
180 | def indebug(ui, message): | |
181 | """debug on input stream (unbundling)""" |
|
181 | """debug on input stream (unbundling)""" | |
182 | ui.debug('bundle2-input: %s' % message) |
|
182 | ui.debug('bundle2-input: %s\n' % message) | |
183 |
|
183 | |||
184 | def validateparttype(parttype): |
|
184 | def validateparttype(parttype): | |
185 | """raise ValueError if a parttype contains invalid character""" |
|
185 | """raise ValueError if a parttype contains invalid character""" | |
@@ -350,7 +350,7 b' def _processpart(op, part):' | |||||
350 | handler = parthandlermapping.get(part.type) |
|
350 | handler = parthandlermapping.get(part.type) | |
351 | if handler is None: |
|
351 | if handler is None: | |
352 | raise error.UnsupportedPartError(parttype=part.type) |
|
352 | raise error.UnsupportedPartError(parttype=part.type) | |
353 |
indebug(op.ui, 'found a handler for part %r |
|
353 | indebug(op.ui, 'found a handler for part %r' % part.type) | |
354 | unknownparams = part.mandatorykeys - handler.params |
|
354 | unknownparams = part.mandatorykeys - handler.params | |
355 | if unknownparams: |
|
355 | if unknownparams: | |
356 | unknownparams = list(unknownparams) |
|
356 | unknownparams = list(unknownparams) | |
@@ -360,7 +360,7 b' def _processpart(op, part):' | |||||
360 | except error.UnsupportedPartError, exc: |
|
360 | except error.UnsupportedPartError, exc: | |
361 | if part.mandatory: # mandatory parts |
|
361 | if part.mandatory: # mandatory parts | |
362 | raise |
|
362 | raise | |
363 |
indebug(op.ui, 'ignoring unsupported advisory part %s |
|
363 | indebug(op.ui, 'ignoring unsupported advisory part %s' % exc) | |
364 | return # skip to part processing |
|
364 | return # skip to part processing | |
365 |
|
365 | |||
366 | # handler is called outside the above try block so that we don't |
|
366 | # handler is called outside the above try block so that we don't | |
@@ -563,7 +563,7 b' def getunbundler(ui, fp, header=None):' | |||||
563 | if unbundlerclass is None: |
|
563 | if unbundlerclass is None: | |
564 | raise util.Abort(_('unknown bundle version %s') % version) |
|
564 | raise util.Abort(_('unknown bundle version %s') % version) | |
565 | unbundler = unbundlerclass(ui, fp) |
|
565 | unbundler = unbundlerclass(ui, fp) | |
566 |
indebug(ui, 'start processing of %s stream |
|
566 | indebug(ui, 'start processing of %s stream' % header) | |
567 | return unbundler |
|
567 | return unbundler | |
568 |
|
568 | |||
569 | class unbundle20(unpackermixin): |
|
569 | class unbundle20(unpackermixin): | |
@@ -580,7 +580,7 b' class unbundle20(unpackermixin):' | |||||
580 | @util.propertycache |
|
580 | @util.propertycache | |
581 | def params(self): |
|
581 | def params(self): | |
582 | """dictionary of stream level parameters""" |
|
582 | """dictionary of stream level parameters""" | |
583 |
indebug(self.ui, 'reading bundle2 stream parameters |
|
583 | indebug(self.ui, 'reading bundle2 stream parameters') | |
584 | params = {} |
|
584 | params = {} | |
585 | paramssize = self._unpack(_fstreamparamsize)[0] |
|
585 | paramssize = self._unpack(_fstreamparamsize)[0] | |
586 | if paramssize < 0: |
|
586 | if paramssize < 0: | |
@@ -613,7 +613,7 b' class unbundle20(unpackermixin):' | |||||
613 | # Some logic will be later added here to try to process the option for |
|
613 | # Some logic will be later added here to try to process the option for | |
614 | # a dict of known parameter. |
|
614 | # a dict of known parameter. | |
615 | if name[0].islower(): |
|
615 | if name[0].islower(): | |
616 |
indebug(self.ui, "ignoring unknown parameter %r |
|
616 | indebug(self.ui, "ignoring unknown parameter %r" % name) | |
617 | else: |
|
617 | else: | |
618 | raise error.UnsupportedPartError(params=(name,)) |
|
618 | raise error.UnsupportedPartError(params=(name,)) | |
619 |
|
619 | |||
@@ -622,14 +622,14 b' class unbundle20(unpackermixin):' | |||||
622 | """yield all parts contained in the stream""" |
|
622 | """yield all parts contained in the stream""" | |
623 | # make sure param have been loaded |
|
623 | # make sure param have been loaded | |
624 | self.params |
|
624 | self.params | |
625 |
indebug(self.ui, 'start extraction of bundle2 parts |
|
625 | indebug(self.ui, 'start extraction of bundle2 parts') | |
626 | headerblock = self._readpartheader() |
|
626 | headerblock = self._readpartheader() | |
627 | while headerblock is not None: |
|
627 | while headerblock is not None: | |
628 | part = unbundlepart(self.ui, headerblock, self._fp) |
|
628 | part = unbundlepart(self.ui, headerblock, self._fp) | |
629 | yield part |
|
629 | yield part | |
630 | part.seek(0, 2) |
|
630 | part.seek(0, 2) | |
631 | headerblock = self._readpartheader() |
|
631 | headerblock = self._readpartheader() | |
632 |
indebug(self.ui, 'end of bundle2 stream |
|
632 | indebug(self.ui, 'end of bundle2 stream') | |
633 |
|
633 | |||
634 | def _readpartheader(self): |
|
634 | def _readpartheader(self): | |
635 | """reads a part header size and return the bytes blob |
|
635 | """reads a part header size and return the bytes blob | |
@@ -639,7 +639,7 b' class unbundle20(unpackermixin):' | |||||
639 | if headersize < 0: |
|
639 | if headersize < 0: | |
640 | raise error.BundleValueError('negative part header size: %i' |
|
640 | raise error.BundleValueError('negative part header size: %i' | |
641 | % headersize) |
|
641 | % headersize) | |
642 |
indebug(self.ui, 'part header size: %i |
|
642 | indebug(self.ui, 'part header size: %i' % headersize) | |
643 | if headersize: |
|
643 | if headersize: | |
644 | return self._readexact(headersize) |
|
644 | return self._readexact(headersize) | |
645 | return None |
|
645 | return None | |
@@ -831,10 +831,10 b' class interrupthandler(unpackermixin):' | |||||
831 | return None |
|
831 | return None | |
832 |
|
832 | |||
833 | def __call__(self): |
|
833 | def __call__(self): | |
834 |
indebug(self.ui, 'bundle2 stream interruption, looking for a part. |
|
834 | indebug(self.ui, 'bundle2 stream interruption, looking for a part.') | |
835 | headerblock = self._readpartheader() |
|
835 | headerblock = self._readpartheader() | |
836 | if headerblock is None: |
|
836 | if headerblock is None: | |
837 |
indebug(self.ui, 'no part found during interruption. |
|
837 | indebug(self.ui, 'no part found during interruption.') | |
838 | return |
|
838 | return | |
839 | part = unbundlepart(self.ui, headerblock, self._fp) |
|
839 | part = unbundlepart(self.ui, headerblock, self._fp) | |
840 | op = interruptoperation(self.ui) |
|
840 | op = interruptoperation(self.ui) | |
@@ -918,7 +918,7 b' class unbundlepart(unpackermixin):' | |||||
918 |
|
918 | |||
919 | pos = self._chunkindex[chunknum][0] |
|
919 | pos = self._chunkindex[chunknum][0] | |
920 | payloadsize = self._unpack(_fpayloadsize)[0] |
|
920 | payloadsize = self._unpack(_fpayloadsize)[0] | |
921 |
indebug(self.ui, 'payload chunk size: %i |
|
921 | indebug(self.ui, 'payload chunk size: %i' % payloadsize) | |
922 | while payloadsize: |
|
922 | while payloadsize: | |
923 | if payloadsize == flaginterrupt: |
|
923 | if payloadsize == flaginterrupt: | |
924 | # interruption detection, the handler will now read a |
|
924 | # interruption detection, the handler will now read a | |
@@ -936,7 +936,7 b' class unbundlepart(unpackermixin):' | |||||
936 | super(unbundlepart, self).tell())) |
|
936 | super(unbundlepart, self).tell())) | |
937 | yield result |
|
937 | yield result | |
938 | payloadsize = self._unpack(_fpayloadsize)[0] |
|
938 | payloadsize = self._unpack(_fpayloadsize)[0] | |
939 |
indebug(self.ui, 'payload chunk size: %i |
|
939 | indebug(self.ui, 'payload chunk size: %i' % payloadsize) | |
940 |
|
940 | |||
941 | def _findchunk(self, pos): |
|
941 | def _findchunk(self, pos): | |
942 | '''for a given payload position, return a chunk number and offset''' |
|
942 | '''for a given payload position, return a chunk number and offset''' | |
@@ -951,16 +951,16 b' class unbundlepart(unpackermixin):' | |||||
951 | """read the header and setup the object""" |
|
951 | """read the header and setup the object""" | |
952 | typesize = self._unpackheader(_fparttypesize)[0] |
|
952 | typesize = self._unpackheader(_fparttypesize)[0] | |
953 | self.type = self._fromheader(typesize) |
|
953 | self.type = self._fromheader(typesize) | |
954 |
indebug(self.ui, 'part type: "%s" |
|
954 | indebug(self.ui, 'part type: "%s"' % self.type) | |
955 | self.id = self._unpackheader(_fpartid)[0] |
|
955 | self.id = self._unpackheader(_fpartid)[0] | |
956 |
indebug(self.ui, 'part id: "%s" |
|
956 | indebug(self.ui, 'part id: "%s"' % self.id) | |
957 | # extract mandatory bit from type |
|
957 | # extract mandatory bit from type | |
958 | self.mandatory = (self.type != self.type.lower()) |
|
958 | self.mandatory = (self.type != self.type.lower()) | |
959 | self.type = self.type.lower() |
|
959 | self.type = self.type.lower() | |
960 | ## reading parameters |
|
960 | ## reading parameters | |
961 | # param count |
|
961 | # param count | |
962 | mancount, advcount = self._unpackheader(_fpartparamcount) |
|
962 | mancount, advcount = self._unpackheader(_fpartparamcount) | |
963 |
indebug(self.ui, 'part parameters: %i |
|
963 | indebug(self.ui, 'part parameters: %i' % (mancount + advcount)) | |
964 | # param size |
|
964 | # param size | |
965 | fparamsizes = _makefpartparamsizes(mancount + advcount) |
|
965 | fparamsizes = _makefpartparamsizes(mancount + advcount) | |
966 | paramsizes = self._unpackheader(fparamsizes) |
|
966 | paramsizes = self._unpackheader(fparamsizes) |
General Comments 0
You need to be logged in to leave comments.
Login now