diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -268,12 +268,13 @@ class bundleoperation(object): * 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 @@ def _processpart(op, part): # 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 @@ class interruptoperation(object): def __init__(self, ui): self.ui = ui self.reply = None + self.captureoutput = False @property def repo(self): diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -1285,6 +1285,11 @@ def unbundle(repo, cg, heads, source, ur # 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 @@ def unbundle(repo, cg, heads, source, ur 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, diff --git a/tests/test-bundle2-exchange.t b/tests/test-bundle2-exchange.t --- a/tests/test-bundle2-exchange.t +++ b/tests/test-bundle2-exchange.t @@ -16,6 +16,7 @@ enable obsolescence > [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 @@ Check error from hook during the unbundl 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]