@@ -266,16 +266,17 @@ class bundleoperation(object):
* a way to retrieve a transaction to add changes to the repo,
* a way to record the result of processing each part,
* 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
def _notransaction():
@@ -357,11 +358,11 @@ def _processpart(op, part):
# handler is called outside the above try block so that we don't
# risk catching KeyErrors from anything other than the
# 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:
handler(op, part)
finally:
@@ -838,10 +839,11 @@ class interruptoperation(object):
"""
def __init__(self, ui):
self.ui = ui
self.reply = None
+ self.captureoutput = False
@property
def repo(self):
raise RuntimeError('no repo access from stream interruption')
@@ -1283,10 +1283,15 @@ def unbundle(repo, cg, heads, source, ur
If the push was raced as PushRaced exception is raised."""
r = 0
# 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
if util.safehasattr(cg, 'params'):
r = None
@@ -1295,23 +1300,24 @@ def unbundle(repo, cg, heads, source, ur
lock = repo.lock()
tr = repo.transaction(source)
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,
mandatory=False)
parts.append(part)
@@ -14,10 +14,11 @@ enable obsolescence
$ cat >> $HGRCPATH << EOF
> [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}
> [web]
> push_ssl = false
@@ -665,5 +666,54 @@ Check error from hook during the unbundl
remote: transaction abort!
remote: Cleaning up the mess...
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]