changeset 24849:aff2aca3420e stable

bundle2: also capture hook output during processing External hook used to directly write on stdout and stderr. As a result their output was not captured by the bundle2 processing. This resulted in confusing out of order output on the client side. We are now capturing hooks output in this context.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 23 Apr 2015 17:03:58 +0100
parents 2f88821856eb
children 6b81309d15a7
files mercurial/bundle2.py mercurial/exchange.py tests/test-bundle2-exchange.t
diffstat 3 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundle2.py	Thu Apr 23 14:57:39 2015 +0100
+++ b/mercurial/bundle2.py	Thu Apr 23 17:03:58 2015 +0100
@@ -354,7 +354,7 @@
         # itself represents a defect of a different variety).
         output = None
         if op.reply is not None:
-            op.ui.pushbuffer(error=True)
+            op.ui.pushbuffer(error=True, subproc=True)
             output = ''
         try:
             handler(op, part)
--- a/mercurial/exchange.py	Thu Apr 23 14:57:39 2015 +0100
+++ b/mercurial/exchange.py	Thu Apr 23 17:03:58 2015 +0100
@@ -1303,7 +1303,7 @@
                 exc.duringunbundle2 = True
                 if r is not None:
                     parts = exc._bundle2salvagedoutput = r.salvageoutput()
-                    repo.ui.pushbuffer(error=True)
+                    repo.ui.pushbuffer(error=True, subproc=True)
                     def recordout(output):
                         part = bundle2.bundlepart('output', data=output,
                                                   mandatory=False)
--- a/tests/test-bundle2-exchange.t	Thu Apr 23 14:57:39 2015 +0100
+++ b/tests/test-bundle2-exchange.t	Thu Apr 23 17:03:58 2015 +0100
@@ -549,6 +549,7 @@
   > reason =
   > [hooks]
   > pretxnclose.failpush = false
+  > txnabort.failpush = echo 'Cleaning up the mess...'
   > EOF
 
   $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
@@ -564,6 +565,7 @@
   remote: adding file changes
   remote: added 1 changesets with 1 changes to 1 files
   remote: transaction abort!
+  remote: Cleaning up the mess...
   remote: rollback completed
   abort: pretxnclose.failpush hook exited with status 1
   [255]
@@ -576,6 +578,7 @@
   remote: adding file changes
   remote: added 1 changesets with 1 changes to 1 files
   remote: transaction abort!
+  remote: Cleaning up the mess...
   remote: rollback completed
   abort: pretxnclose.failpush hook exited with status 1
   remote: pre-close-tip:e7ec4e813ba6 draft 
@@ -589,6 +592,7 @@
   remote: adding file changes
   remote: added 1 changesets with 1 changes to 1 files
   remote: transaction abort!
+  remote: Cleaning up the mess...
   remote: rollback completed
   abort: pretxnclose.failpush hook exited with status 1
   [255]