diff mercurial/bundle2.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 5b3717e1a3ea
children 1daad9dcdba2
line wrap: on
line diff
--- a/mercurial/bundle2.py	Mon Apr 21 20:04:54 2014 -0700
+++ b/mercurial/bundle2.py	Mon Apr 21 17:51:58 2014 -0700
@@ -760,3 +760,9 @@
     """Used to transmit unknown part error over the wire"""
     manargs = dict(inpart.mandatoryparams)
     raise UnknownPartError(manargs['parttype'])
+
+@parthandler('b2x:error:pushraced')
+def handlereplycaps(op, inpart):
+    """Used to transmit push race error over the wire"""
+    manargs = dict(inpart.mandatoryparams)
+    raise error.ResponseError(_('push failed:'), manargs['message'])