Patchwork [2,of,3,V2-rebased] bundle2: also capture reply capability on failure

login
register
mail settings
Submitter Pierre-Yves David
Date June 9, 2015, 5:56 p.m.
Message ID <c3795ae132413685580d.1433872587@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/9570/
State Accepted
Headers show

Comments

Pierre-Yves David - June 9, 2015, 5:56 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1433577027 25200
#      Sat Jun 06 00:50:27 2015 -0700
# Node ID c3795ae132413685580d1b2d51abdb46bc134476
# Parent  bdd7159ee71ea7d4a706bd48f0cfa008dc5c5b99
bundle2: also capture reply capability on failure

When unbundling over the wire is aborted, we have a mechanism to convey the
error inside a bundle part. As we add support for more error, we need to know if
the client will support them. For this purpose, we duck punch the reply
capabilities of the client on the raised extensions.

This is similar to what is done to salvage the server output on error.

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -345,12 +345,15 @@  def processbundle(repo, unbundler, trans
         # needed to handle different return codes to unbundle according to the
         # type of bundle. We should probably clean up or drop this return code
         # craziness in a future version.
         exc.duringunbundle2 = True
         salvaged = []
+        replycaps = None
         if op.reply is not None:
             salvaged = op.reply.salvageoutput()
+            replycaps = op.reply.capabilities
+        exc._replycaps = replycaps
         exc._bundle2salvagedoutput = salvaged
         raise
     finally:
         repo.ui.debug('bundle2-input-bundle: %i parts total\n' % nbpart)