bundle2: rename b2x:error:unknownpart to b2x:error:unsupportedcontent
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 27 May 2014 10:32:07 -0700
changeset 21619 292331e906d7
parent 21618 7568f5c1c801
child 21620 6eaa71b2a3cc
bundle2: rename b2x:error:unknownpart to b2x:error:unsupportedcontent This is a backward compatibility breakage per se. But bundle2 was explicitly flagged as experimental, and this is one an error path anyway. So the worse possible outcome from this change is to still have a crash but with a different message.
mercurial/bundle2.py
mercurial/wireproto.py
--- a/mercurial/bundle2.py	Wed May 28 15:31:05 2014 -0700
+++ b/mercurial/bundle2.py	Tue May 27 10:32:07 2014 -0700
@@ -828,9 +828,9 @@
     """Used to transmit abort error over the wire"""
     raise util.Abort(inpart.params['message'], hint=inpart.params.get('hint'))
 
-@parthandler('b2x:error:unknownpart')
+@parthandler('b2x:error:unsupportedcontent')
 def handlereplycaps(op, inpart):
-    """Used to transmit unknown part error over the wire"""
+    """Used to transmit unknown content error over the wire"""
     raise error.BundleValueError(inpart.params['parttype'])
 
 @parthandler('b2x:error:pushraced')
--- a/mercurial/wireproto.py	Wed May 28 15:31:05 2014 -0700
+++ b/mercurial/wireproto.py	Tue May 27 10:32:07 2014 -0700
@@ -805,7 +805,8 @@
             os.unlink(tempname)
     except error.BundleValueError, exc:
             bundler = bundle2.bundle20(repo.ui)
-            bundler.newpart('B2X:ERROR:UNKNOWNPART', [('parttype', str(exc))])
+            errpart = bundler.newpart('B2X:ERROR:UNSUPPORTEDCONTENT')
+            errpart.addparam('parttype', str(exc))
             return streamres(bundler.getchunks())
     except util.Abort, inst:
         # The old code we moved used sys.stderr directly.