Show More
@@ -145,6 +145,7 b' future, dropping the stream may become a' | |||||
145 | preserve. |
|
145 | preserve. | |
146 | """ |
|
146 | """ | |
147 |
|
147 | |||
|
148 | import sys | |||
148 | import util |
|
149 | import util | |
149 | import struct |
|
150 | import struct | |
150 | import urllib |
|
151 | import urllib | |
@@ -673,9 +674,22 b' class bundlepart(object):' | |||||
673 | yield _pack(_fpartheadersize, len(headerchunk)) |
|
674 | yield _pack(_fpartheadersize, len(headerchunk)) | |
674 | yield headerchunk |
|
675 | yield headerchunk | |
675 | ## payload |
|
676 | ## payload | |
676 | for chunk in self._payloadchunks(): |
|
677 | try: | |
677 | yield _pack(_fpayloadsize, len(chunk)) |
|
678 | for chunk in self._payloadchunks(): | |
678 | yield chunk |
|
679 | yield _pack(_fpayloadsize, len(chunk)) | |
|
680 | yield chunk | |||
|
681 | except Exception, exc: | |||
|
682 | # backup exception data for later | |||
|
683 | exc_info = sys.exc_info() | |||
|
684 | msg = 'unexpected error: %s' % exc | |||
|
685 | interpart = bundlepart('b2x:error:abort', [('message', msg)]) | |||
|
686 | interpart.id = 0 | |||
|
687 | yield _pack(_fpayloadsize, -1) | |||
|
688 | for chunk in interpart.getchunks(): | |||
|
689 | yield chunk | |||
|
690 | # abort current part payload | |||
|
691 | yield _pack(_fpayloadsize, 0) | |||
|
692 | raise exc_info[0], exc_info[1], exc_info[2] | |||
679 | # end of payload |
|
693 | # end of payload | |
680 | yield _pack(_fpayloadsize, 0) |
|
694 | yield _pack(_fpayloadsize, 0) | |
681 | self._generated = True |
|
695 | self._generated = True |
@@ -777,25 +777,22 b' with reply' | |||||
777 |
|
777 | |||
778 | Check handling of exception during generation. |
|
778 | Check handling of exception during generation. | |
779 | ---------------------------------------------- |
|
779 | ---------------------------------------------- | |
780 | (is currently not right) |
|
|||
781 |
|
780 | |||
782 |
$ |
|
781 | $ hg bundle2 --genraise > ../genfailed.hg2 | |
783 | abort: Someone set up us the bomb! |
|
782 | abort: Someone set up us the bomb! | |
784 | [255] |
|
783 | [255] | |
785 |
|
784 | |||
786 | Should still be a valid bundle |
|
785 | Should still be a valid bundle | |
787 | (is currently not right) |
|
|||
788 |
|
786 | |||
789 |
$ |
|
787 | $ cat ../genfailed.hg2 | |
790 | HG2Y\x00\x00\x00\x00\x00\x00\x00\x11 (esc) |
|
788 | HG2Y\x00\x00\x00\x00\x00\x00\x00\x11 (esc) | |
791 | b2x:output\x00\x00\x00\x00\x00\x00 (no-eol) (esc) |
|
789 | b2x:output\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00L\x0fb2x:error:abort\x00\x00\x00\x00\x01\x00\x07-messageunexpected error: Someone set up us the bomb!\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc) | |
792 |
|
790 | |||
793 | And its handling on the other size raise a clean exception |
|
791 | And its handling on the other size raise a clean exception | |
794 | (is currently not right) |
|
|||
795 |
|
792 | |||
796 |
$ |
|
793 | $ cat ../genfailed.hg2 | hg unbundle2 | |
797 | 0 unread bytes |
|
794 | 0 unread bytes | |
798 | abort: stream ended unexpectedly (got 0 bytes, expected 4) |
|
795 | abort: unexpected error: Someone set up us the bomb! | |
799 |
|
|
796 | [255] | |
800 |
|
797 | |||
801 |
|
798 |
General Comments 0
You need to be logged in to leave comments.
Login now