equal
deleted
inserted
replaced
334 part = None |
334 part = None |
335 nbpart = 0 |
335 nbpart = 0 |
336 try: |
336 try: |
337 for nbpart, part in iterparts: |
337 for nbpart, part in iterparts: |
338 _processpart(op, part) |
338 _processpart(op, part) |
339 except BaseException, exc: |
339 except BaseException as exc: |
340 for nbpart, part in iterparts: |
340 for nbpart, part in iterparts: |
341 # consume the bundle content |
341 # consume the bundle content |
342 part.seek(0, 2) |
342 part.seek(0, 2) |
343 # Small hack to let caller code distinguish exceptions from bundle2 |
343 # Small hack to let caller code distinguish exceptions from bundle2 |
344 # processing from processing the old format. This is mostly |
344 # processing from processing the old format. This is mostly |
378 unknownparams.sort() |
378 unknownparams.sort() |
379 status = 'unsupported-params (%s)' % unknownparams |
379 status = 'unsupported-params (%s)' % unknownparams |
380 raise error.UnsupportedPartError(parttype=part.type, |
380 raise error.UnsupportedPartError(parttype=part.type, |
381 params=unknownparams) |
381 params=unknownparams) |
382 status = 'supported' |
382 status = 'supported' |
383 except error.UnsupportedPartError, exc: |
383 except error.UnsupportedPartError as exc: |
384 if part.mandatory: # mandatory parts |
384 if part.mandatory: # mandatory parts |
385 raise |
385 raise |
386 indebug(op.ui, 'ignoring unsupported advisory part %s' % exc) |
386 indebug(op.ui, 'ignoring unsupported advisory part %s' % exc) |
387 return # skip to part processing |
387 return # skip to part processing |
388 finally: |
388 finally: |
583 def tell(self): |
583 def tell(self): |
584 """return the file offset, or None if file is not seekable""" |
584 """return the file offset, or None if file is not seekable""" |
585 if self._seekable: |
585 if self._seekable: |
586 try: |
586 try: |
587 return self._fp.tell() |
587 return self._fp.tell() |
588 except IOError, e: |
588 except IOError as e: |
589 if e.errno == errno.ESPIPE: |
589 if e.errno == errno.ESPIPE: |
590 self._seekable = False |
590 self._seekable = False |
591 else: |
591 else: |
592 raise |
592 raise |
593 return None |
593 return None |
839 try: |
839 try: |
840 for chunk in self._payloadchunks(): |
840 for chunk in self._payloadchunks(): |
841 outdebug(ui, 'payload chunk size: %i' % len(chunk)) |
841 outdebug(ui, 'payload chunk size: %i' % len(chunk)) |
842 yield _pack(_fpayloadsize, len(chunk)) |
842 yield _pack(_fpayloadsize, len(chunk)) |
843 yield chunk |
843 yield chunk |
844 except BaseException, exc: |
844 except BaseException as exc: |
845 # backup exception data for later |
845 # backup exception data for later |
846 ui.debug('bundle2-input-stream-interrupt: encoding exception %s' |
846 ui.debug('bundle2-input-stream-interrupt: encoding exception %s' |
847 % exc) |
847 % exc) |
848 exc_info = sys.exc_info() |
848 exc_info = sys.exc_info() |
849 msg = 'unexpected error: %s' % exc |
849 msg = 'unexpected error: %s' % exc |
1246 part = op.reply.newpart('reply:changegroup') |
1246 part = op.reply.newpart('reply:changegroup') |
1247 part.addparam('in-reply-to', str(inpart.id), mandatory=False) |
1247 part.addparam('in-reply-to', str(inpart.id), mandatory=False) |
1248 part.addparam('return', '%i' % ret, mandatory=False) |
1248 part.addparam('return', '%i' % ret, mandatory=False) |
1249 try: |
1249 try: |
1250 real_part.validate() |
1250 real_part.validate() |
1251 except util.Abort, e: |
1251 except util.Abort as e: |
1252 raise util.Abort(_('bundle at %s is corrupted:\n%s') % |
1252 raise util.Abort(_('bundle at %s is corrupted:\n%s') % |
1253 (util.hidepassword(raw_url), str(e))) |
1253 (util.hidepassword(raw_url), str(e))) |
1254 assert not inpart.read() |
1254 assert not inpart.read() |
1255 |
1255 |
1256 @parthandler('reply:changegroup', ('return', 'in-reply-to')) |
1256 @parthandler('reply:changegroup', ('return', 'in-reply-to')) |