changeset 24878:e530cde6d115 stable

bundle2: disable ouput capture unless we use http (issue4613 issue4615) The current bundle2 processing was capturing all output. This is nice as it provide better meta data about what output what, but this was changing two things: 1) adding a prefix "remote: " to "other" output during local push (issue4613) 2) local and ssh push does not provide real time output anymore (issue4615) As we are unsure about what form should be used in (1) and how to solve (2) we disable output capture in this two cases. Output capture can be forced using an experimental option.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 28 Apr 2015 17:38:02 -0700
parents cc497780eaf9
children b3142ea2a0d4 194207694def
files mercurial/bundle2.py mercurial/exchange.py tests/test-bundle2-exchange.t
diffstat 3 files changed, 63 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundle2.py	Tue Feb 03 15:01:43 2015 -0500
+++ b/mercurial/bundle2.py	Tue Apr 28 17:38:02 2015 -0700
@@ -268,12 +268,13 @@
     * a way to construct a bundle response when applicable.
     """
 
-    def __init__(self, repo, transactiongetter):
+    def __init__(self, repo, transactiongetter, captureoutput=True):
         self.repo = repo
         self.ui = repo.ui
         self.records = unbundlerecords()
         self.gettransaction = transactiongetter
         self.reply = None
+        self.captureoutput = captureoutput
 
 class TransactionUnavailable(RuntimeError):
     pass
@@ -359,7 +360,7 @@
         # parthandlermapping lookup (any KeyError raised by handler()
         # itself represents a defect of a different variety).
         output = None
-        if op.reply is not None:
+        if op.captureoutput and op.reply is not None:
             op.ui.pushbuffer(error=True, subproc=True)
             output = ''
         try:
@@ -840,6 +841,7 @@
     def __init__(self, ui):
         self.ui = ui
         self.reply = None
+        self.captureoutput = False
 
     @property
     def repo(self):
--- a/mercurial/exchange.py	Tue Feb 03 15:01:43 2015 -0500
+++ b/mercurial/exchange.py	Tue Apr 28 17:38:02 2015 -0700
@@ -1285,6 +1285,11 @@
     # need a transaction when processing a bundle2 stream
     wlock = lock = tr = None
     recordout = None
+    # quick fix for output mismatch with bundle2 in 3.4
+    captureoutput = repo.ui.configbool('experimental', 'bundle2-output-capture',
+                                       False)
+    if url.startswith('remote:http:') or url.startswith('remote:https:'):
+        captureoutput = True
     try:
         check_heads(repo, heads, 'uploading changes')
         # push can proceed
@@ -1297,19 +1302,20 @@
                 tr.hookargs['source'] = source
                 tr.hookargs['url'] = url
                 tr.hookargs['bundle2'] = '1'
-                op = bundle2.bundleoperation(repo, lambda: tr)
+                op = bundle2.bundleoperation(repo, lambda: tr,
+                                             captureoutput=captureoutput)
                 try:
                     r = bundle2.processbundle(repo, cg, op=op)
                 finally:
                     r = op.reply
-                    if r is not None:
+                    if captureoutput and r is not None:
                         repo.ui.pushbuffer(error=True, subproc=True)
                         def recordout(output):
                             r.newpart('output', data=output, mandatory=False)
                 tr.close()
             except Exception, exc:
                 exc.duringunbundle2 = True
-                if r is not None:
+                if captureoutput and r is not None:
                     parts = exc._bundle2salvagedoutput = r.salvageoutput()
                     def recordout(output):
                         part = bundle2.bundlepart('output', data=output,
--- a/tests/test-bundle2-exchange.t	Tue Feb 03 15:01:43 2015 -0500
+++ b/tests/test-bundle2-exchange.t	Tue Apr 28 17:38:02 2015 -0700
@@ -16,6 +16,7 @@
   > [experimental]
   > evolution=createmarkers,exchange
   > bundle2-exp=True
+  > bundle2-output-capture=True
   > [ui]
   > ssh=python "$TESTDIR/dummyssh"
   > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
@@ -667,3 +668,52 @@
   remote: rollback completed
   abort: pretxnchangegroup hook exited with status 1
   [255]
+
+Check output capture control.
+
+(should be still forced for http, disabled for local and ssh)
+
+  $ cat >> $HGRCPATH << EOF
+  > [experimental]
+  > bundle2-output-capture=False
+  > EOF
+
+  $ hg -R main push other -r e7ec4e813ba6
+  pushing to other
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  Fail early!
+  transaction abort!
+  Cleaning up the mess...
+  rollback completed
+  abort: pretxnchangegroup hook exited with status 1
+  [255]
+  $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
+  pushing to ssh://user@dummy/other
+  searching for changes
+  abort: pretxnchangegroup hook exited with status 1
+  remote: adding changesets
+  remote: adding manifests
+  remote: adding file changes
+  remote: added 1 changesets with 1 changes to 1 files
+  remote: Fail early!
+  remote: transaction abort!
+  remote: Cleaning up the mess...
+  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
+  remote: Fail early!
+  remote: transaction abort!
+  remote: Cleaning up the mess...
+  remote: rollback completed
+  abort: pretxnchangegroup hook exited with status 1
+  [255]