changeset 24795:f9aa4cb8f2dd

bundle2: store the salvaged output on the exception object The re-handling of output is happening in some 'unbundle' callers. We have to transmit the output information to this place so we stick it on the exception. This is the third step in our quest for preserving the server output on error (issue4594). We want to be able to copy the output part from the aborted reply into the exception bundle.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 16 Apr 2015 03:17:01 -0400
parents 21f2e8f48ae1
children 61ff209fc01d
files mercurial/bundle2.py mercurial/exchange.py
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundle2.py	Thu Apr 16 03:16:04 2015 -0400
+++ b/mercurial/bundle2.py	Thu Apr 16 03:17:01 2015 -0400
@@ -318,6 +318,10 @@
         # type of bundle. We should probably clean up or drop this return code
         # craziness in a future version.
         exc.duringunbundle2 = True
+        salvaged = []
+        if op.reply is not None:
+            salvaged = op.reply.salvageoutput()
+        exc._bundle2salvagedoutput = salvaged
         raise
     return op
 
--- a/mercurial/exchange.py	Thu Apr 16 03:16:04 2015 -0400
+++ b/mercurial/exchange.py	Thu Apr 16 03:17:01 2015 -0400
@@ -1288,6 +1288,7 @@
         check_heads(repo, heads, 'uploading changes')
         # push can proceed
         if util.safehasattr(cg, 'params'):
+            r = None
             try:
                 wlock = repo.wlock()
                 lock = repo.lock()
@@ -1299,6 +1300,8 @@
                 tr.close()
             except Exception, exc:
                 exc.duringunbundle2 = True
+                if r is not None:
+                    exc._bundle2salvagedoutput = r.salvageoutput()
                 raise
         else:
             lock = repo.lock()