Mercurial > public > mercurial-scm > hg
comparison mercurial/bundle2.py @ 25181:d26703eb3dc5
bundle2: use BaseException in bundle2
We can ensure we fail over properly in more cases.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 18 May 2015 13:23:14 -0500 |
parents | e530cde6d115 |
children | 8f2c362bcb58 |
comparison
equal
deleted
inserted
replaced
25180:3ff2a5dc7c20 | 25181:d26703eb3dc5 |
---|---|
313 iterparts = unbundler.iterparts() | 313 iterparts = unbundler.iterparts() |
314 part = None | 314 part = None |
315 try: | 315 try: |
316 for part in iterparts: | 316 for part in iterparts: |
317 _processpart(op, part) | 317 _processpart(op, part) |
318 except Exception, exc: | 318 except BaseException, exc: |
319 for part in iterparts: | 319 for part in iterparts: |
320 # consume the bundle content | 320 # consume the bundle content |
321 part.seek(0, 2) | 321 part.seek(0, 2) |
322 # Small hack to let caller code distinguish exceptions from bundle2 | 322 # Small hack to let caller code distinguish exceptions from bundle2 |
323 # processing from processing the old format. This is mostly | 323 # processing from processing the old format. This is mostly |
760 ## payload | 760 ## payload |
761 try: | 761 try: |
762 for chunk in self._payloadchunks(): | 762 for chunk in self._payloadchunks(): |
763 yield _pack(_fpayloadsize, len(chunk)) | 763 yield _pack(_fpayloadsize, len(chunk)) |
764 yield chunk | 764 yield chunk |
765 except Exception, exc: | 765 except BaseException, exc: |
766 # backup exception data for later | 766 # backup exception data for later |
767 exc_info = sys.exc_info() | 767 exc_info = sys.exc_info() |
768 msg = 'unexpected error: %s' % exc | 768 msg = 'unexpected error: %s' % exc |
769 interpart = bundlepart('error:abort', [('message', msg)], | 769 interpart = bundlepart('error:abort', [('message', msg)], |
770 mandatory=False) | 770 mandatory=False) |