Mercurial > public > mercurial-scm > hg-stable
diff mercurial/wireproto.py @ 21186:9f3652e851f8 stable
bundle2: gracefully handle PushRaced error during unbundle
Same drill again. We catch the PushRaced error, check if it cames from
a bundle2 processing, if so we turn it into a bundle2 with a part
transporting error information to be reraised client side.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 21 Apr 2014 17:51:58 -0700 |
parents | 28d76afa1568 |
children | 5e08f3b65510 3cb2da25b171 |
line wrap: on
line diff
--- a/mercurial/wireproto.py Mon Apr 21 20:04:54 2014 -0700 +++ b/mercurial/wireproto.py Mon Apr 21 17:51:58 2014 -0700 @@ -827,4 +827,11 @@ sys.stderr.write("abort: %s\n" % inst) return pushres(0) except error.PushRaced, exc: - return pusherr(str(exc)) + if getattr(exc, 'duringunbundle2', False): + bundler = bundle2.bundle20(repo.ui) + part = bundle2.bundlepart('B2X:ERROR:PUSHRACED', + [('message', str(exc))]) + bundler.addpart(part) + return streamres(bundler.getchunks()) + else: + return pusherr(str(exc))