Patchwork [4,of,5] bundle2: also capture reply capability on failure

login
register
mail settings
Submitter Pierre-Yves David
Date June 8, 2015, 5:29 p.m.
Message ID <66fcbd3d716ab3e992b3.1433784558@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/9556/
State Superseded
Commit 2a4d3645f093787929df8f00c75c73dfd70775a9
Headers show

Comments

Pierre-Yves David - June 8, 2015, 5:29 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 66fcbd3d716ab3e992b3ef2e6797390c75512ab1
# Parent  5be1b649c5236da4d040f4482dabeaf8c263d690
bundle2: also capture reply capability on failure

When unbundling over the wire is aborted during, 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.
Augie Fackler - June 9, 2015, 3:11 p.m.
On Mon, Jun 08, 2015 at 10:29:18AM -0700, Pierre-Yves David wrote:
> # 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 66fcbd3d716ab3e992b3ef2e6797390c75512ab1
> # Parent  5be1b649c5236da4d040f4482dabeaf8c263d690
> bundle2: also capture reply capability on failure
>
> When unbundling over the wire is aborted during, we have a mechanism to convey

there should be a word after "during" but I can't guess what it should be :(

> 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.
>
> 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)
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
Pierre-Yves David - June 9, 2015, 5:28 p.m.
On 06/09/2015 08:11 AM, Augie Fackler wrote:
> On Mon, Jun 08, 2015 at 10:29:18AM -0700, Pierre-Yves David wrote:
>> # 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 66fcbd3d716ab3e992b3ef2e6797390c75512ab1
>> # Parent  5be1b649c5236da4d040f4482dabeaf8c263d690
>> bundle2: also capture reply capability on failure
>>
>> When unbundling over the wire is aborted during, we have a mechanism to convey
>
> there should be a word after "during" but I can't guess what it should be :(

Actually, just drop during.

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)