mercurial/exchange.py
branchstable
changeset 24847 b705e5ab3b07
parent 24795 f9aa4cb8f2dd
child 24849 aff2aca3420e
--- a/mercurial/exchange.py	Fri Apr 24 00:46:48 2015 +0100
+++ b/mercurial/exchange.py	Thu Apr 23 14:20:36 2015 +0100
@@ -1284,6 +1284,7 @@
     r = 0
     # need a transaction when processing a bundle2 stream
     wlock = lock = tr = None
+    recordout = None
     try:
         check_heads(repo, heads, 'uploading changes')
         # push can proceed
@@ -1301,11 +1302,18 @@
             except Exception, exc:
                 exc.duringunbundle2 = True
                 if r is not None:
-                    exc._bundle2salvagedoutput = r.salvageoutput()
+                    parts = exc._bundle2salvagedoutput = r.salvageoutput()
+                    repo.ui.pushbuffer(error=True)
+                    def recordout(output):
+                        part = bundle2.bundlepart('output', data=output,
+                                                  mandatory=False)
+                        parts.append(part)
                 raise
         else:
             lock = repo.lock()
             r = changegroup.addchangegroup(repo, cg, source, url)
     finally:
         lockmod.release(tr, lock, wlock)
+        if recordout is not None:
+            recordout(repo.ui.popbuffer())
     return r