Patchwork [5,of,7] bundle2-wireproto: properly propagate the server output on error (issue4594)

login
register
mail settings
Submitter Pierre-Yves David
Date April 16, 2015, 9:25 a.m.
Message ID <dd5533374a6c23410d2f.1429176347@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/8707/
State Accepted
Headers show

Comments

Pierre-Yves David - April 16, 2015, 9:25 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1429168657 14400
#      Thu Apr 16 03:17:37 2015 -0400
# Node ID dd5533374a6c23410d2f0fc3b3b46c61bebe7894
# Parent  7772d0136feae85080cdf888c5896502d37b7f55
bundle2-wireproto: properly propagate the server output on error (issue4594)

In case of errors, output parts salvaged from the reply bundle are re-injected
into the bundle carrying the exception.

We still need to fix the situation for non-wireprotocol push.

Patch

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -856,10 +856,12 @@  def unbundle(repo, proto, heads):
                 return pushres(0)
             except error.PushRaced:
                 return pusherr(str(exc))
 
         bundler = bundle2.bundle20(repo.ui)
+        for out in getattr(exc, '_bundle2salvagedoutput', ()):
+            bundler.addpart(out)
         try:
             raise
         except error.BundleValueError, exc:
             errpart = bundler.newpart('error:unsupportedcontent')
             if exc.parttype is not None:
diff --git a/tests/test-bundle2-exchange.t b/tests/test-bundle2-exchange.t
--- a/tests/test-bundle2-exchange.t
+++ b/tests/test-bundle2-exchange.t
@@ -565,19 +565,27 @@  Doing the actual push: hook abort
   [255]
 
   $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
   pushing to ssh://user@dummy/other
   searching for changes
+  remote: adding changesets
+  remote: adding manifests
+  remote: adding file changes
+  remote: added 1 changesets with 1 changes to 1 files
   abort: pretxnclose.failpush hook exited with status 1
   remote: pre-close-tip:e7ec4e813ba6 draft 
   remote: transaction abort!
   remote: rollback completed
   [255]
 
   $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
   pushing to http://localhost:$HGPORT2/
   searching for changes
+  remote: adding changesets
+  remote: adding manifests
+  remote: adding file changes
+  remote: added 1 changesets with 1 changes to 1 files
   abort: pretxnclose.failpush hook exited with status 1
   [255]
 
 (check that no 'pending' files remain)