diff mercurial/bundle2.py @ 21177:952af771bc17 stable

bundle2: gracefully handle abort during unbundle Clients expect a bundle2 reply to their bundle2 submission. So we catch the Abort error and turn it into a bundle2 containing a part transporting the exception data. The unbundling of this reply will raise the error again.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 21 Apr 2014 15:48:52 -0700
parents 70fcb0a71445
children 372f4772f7a0
line wrap: on
line diff
--- a/mercurial/bundle2.py	Tue Apr 22 11:22:41 2014 -0700
+++ b/mercurial/bundle2.py	Mon Apr 21 15:48:52 2014 -0700
@@ -743,3 +743,9 @@
     if op.reply is None:
         op.reply = bundle20(op.ui, caps)
 
+@parthandler('b2x:error:abort')
+def handlereplycaps(op, inpart):
+    """Used to transmit abort error over the wire"""
+    manargs = dict(inpart.mandatoryparams)
+    advargs = dict(inpart.advisoryparams)
+    raise util.Abort(manargs['message'], hint=advargs.get('hint'))