Patchwork [07,of,12,stable] bundle2: catch UnknownPartError during local push

login
register
mail settings
Submitter Pierre-Yves David
Date April 22, 2014, 8:10 p.m.
Message ID <6ab6a29964dbf3113ba8.1398197451@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4426/
State Accepted
Commit 08c84fd99aac8a6cc978c244f1bad10b28fb9aaa
Headers show

Comments

Pierre-Yves David - April 22, 2014, 8:10 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1398192094 25200
#      Tue Apr 22 11:41:34 2014 -0700
# Branch stable
# Node ID 6ab6a29964dbf3113ba85f1d8755610eb03e283f
# Parent  4c01060d31545244d980895ab9c29e9268e685be
bundle2: catch UnknownPartError during local push

When doing local push, UnknownPartError from the server will be raised directly
to the client. We need to catch them too.

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -223,11 +223,14 @@  def _pushbundle2(pushop):
     # add the changegroup bundle
     cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing)
     cgpart = bundle2.bundlepart('B2X:CHANGEGROUP', data=cg.getchunks())
     bundler.addpart(cgpart)
     stream = util.chunkbuffer(bundler.getchunks())
-    reply = pushop.remote.unbundle(stream, ['force'], 'push')
+    try:
+        reply = pushop.remote.unbundle(stream, ['force'], 'push')
+    except bundle2.UnknownPartError, exc:
+        raise util.Abort('missing support for %s' % exc)
     try:
         op = bundle2.processbundle(pushop.repo, reply)
     except bundle2.UnknownPartError, exc:
         raise util.Abort('missing support for %s' % exc)
     cgreplies = op.records.getreplies(cgpart.id)