Mercurial > public > mercurial-scm > hg-stable
diff mercurial/wireproto.py @ 21183:4345274adc4b stable
bundle2: gracefully handle UnknownPartError during unbundle
Same as for Abort error, we catch the error, encode it into a bundle2 reply
(expected by the client) and stream this reply. The client processing of the
error will raise the exception again.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 21 Apr 2014 16:02:03 -0700 |
parents | 952af771bc17 |
children | 28d76afa1568 |
line wrap: on
line diff
--- a/mercurial/wireproto.py Tue Apr 22 11:41:34 2014 -0700 +++ b/mercurial/wireproto.py Mon Apr 21 16:02:03 2014 -0700 @@ -803,6 +803,12 @@ finally: fp.close() os.unlink(tempname) + except bundle2.UnknownPartError, exc: + bundler = bundle2.bundle20(repo.ui) + part = bundle2.bundlepart('B2X:ERROR:UNKNOWNPART', + [('parttype', str(exc))]) + bundler.addpart(part) + return streamres(bundler.getchunks()) except util.Abort, inst: # The old code we moved used sys.stderr directly. # We did not change it to minimise code change.