diff mercurial/exchange.py @ 24847:b705e5ab3b07 stable

bundle2: capture transaction rollback message output (issue4614) The output from the transaction rollback was not included into the reply bundle. It was eventually caught by the usual 'unbundle' output capture and sent to the client but the result was out of order on the client side. We now capture the output for the transaction release and transmit it the same way as all other output. We should probably rethink the whole output capture things but this would not be appropriate for stable. The is still multiple cases were output failed to be properly capture, they will be fixed in later changesets.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 23 Apr 2015 14:20:36 +0100
parents f9aa4cb8f2dd
children aff2aca3420e
line wrap: on
line diff
--- 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