mercurial/wireproto.py
changeset 21600 5e08f3b65510
parent 21186 9f3652e851f8
child 21617 0cfda08afd24
--- a/mercurial/wireproto.py	Fri May 23 15:54:18 2014 -0700
+++ b/mercurial/wireproto.py	Fri May 23 15:59:19 2014 -0700
@@ -805,9 +805,7 @@
             os.unlink(tempname)
     except bundle2.UnknownPartError, exc:
             bundler = bundle2.bundle20(repo.ui)
-            part = bundle2.bundlepart('B2X:ERROR:UNKNOWNPART',
-                                      [('parttype', str(exc))])
-            bundler.addpart(part)
+            bundler.newpart('B2X:ERROR:UNKNOWNPART', [('parttype', str(exc))])
             return streamres(bundler.getchunks())
     except util.Abort, inst:
         # The old code we moved used sys.stderr directly.
@@ -829,9 +827,7 @@
     except error.PushRaced, exc:
         if getattr(exc, 'duringunbundle2', False):
             bundler = bundle2.bundle20(repo.ui)
-            part = bundle2.bundlepart('B2X:ERROR:PUSHRACED',
-                                      [('message', str(exc))])
-            bundler.addpart(part)
+            bundler.newpart('B2X:ERROR:PUSHRACED', [('message', str(exc))])
             return streamres(bundler.getchunks())
         else:
             return pusherr(str(exc))