Show More
@@ -268,12 +268,13 b' class bundleoperation(object):' | |||||
268 | * a way to construct a bundle response when applicable. |
|
268 | * a way to construct a bundle response when applicable. | |
269 | """ |
|
269 | """ | |
270 |
|
270 | |||
271 | def __init__(self, repo, transactiongetter): |
|
271 | def __init__(self, repo, transactiongetter, captureoutput=True): | |
272 | self.repo = repo |
|
272 | self.repo = repo | |
273 | self.ui = repo.ui |
|
273 | self.ui = repo.ui | |
274 | self.records = unbundlerecords() |
|
274 | self.records = unbundlerecords() | |
275 | self.gettransaction = transactiongetter |
|
275 | self.gettransaction = transactiongetter | |
276 | self.reply = None |
|
276 | self.reply = None | |
|
277 | self.captureoutput = captureoutput | |||
277 |
|
278 | |||
278 | class TransactionUnavailable(RuntimeError): |
|
279 | class TransactionUnavailable(RuntimeError): | |
279 | pass |
|
280 | pass | |
@@ -359,7 +360,7 b' def _processpart(op, part):' | |||||
359 | # parthandlermapping lookup (any KeyError raised by handler() |
|
360 | # parthandlermapping lookup (any KeyError raised by handler() | |
360 | # itself represents a defect of a different variety). |
|
361 | # itself represents a defect of a different variety). | |
361 | output = None |
|
362 | output = None | |
362 | if op.reply is not None: |
|
363 | if op.captureoutput and op.reply is not None: | |
363 | op.ui.pushbuffer(error=True, subproc=True) |
|
364 | op.ui.pushbuffer(error=True, subproc=True) | |
364 | output = '' |
|
365 | output = '' | |
365 | try: |
|
366 | try: | |
@@ -840,6 +841,7 b' class interruptoperation(object):' | |||||
840 | def __init__(self, ui): |
|
841 | def __init__(self, ui): | |
841 | self.ui = ui |
|
842 | self.ui = ui | |
842 | self.reply = None |
|
843 | self.reply = None | |
|
844 | self.captureoutput = False | |||
843 |
|
845 | |||
844 | @property |
|
846 | @property | |
845 | def repo(self): |
|
847 | def repo(self): |
@@ -1285,6 +1285,11 b' def unbundle(repo, cg, heads, source, ur' | |||||
1285 | # need a transaction when processing a bundle2 stream |
|
1285 | # need a transaction when processing a bundle2 stream | |
1286 | wlock = lock = tr = None |
|
1286 | wlock = lock = tr = None | |
1287 | recordout = None |
|
1287 | recordout = None | |
|
1288 | # quick fix for output mismatch with bundle2 in 3.4 | |||
|
1289 | captureoutput = repo.ui.configbool('experimental', 'bundle2-output-capture', | |||
|
1290 | False) | |||
|
1291 | if url.startswith('remote:http:') or url.startswith('remote:https:'): | |||
|
1292 | captureoutput = True | |||
1288 | try: |
|
1293 | try: | |
1289 | check_heads(repo, heads, 'uploading changes') |
|
1294 | check_heads(repo, heads, 'uploading changes') | |
1290 | # push can proceed |
|
1295 | # push can proceed | |
@@ -1297,19 +1302,20 b' def unbundle(repo, cg, heads, source, ur' | |||||
1297 | tr.hookargs['source'] = source |
|
1302 | tr.hookargs['source'] = source | |
1298 | tr.hookargs['url'] = url |
|
1303 | tr.hookargs['url'] = url | |
1299 | tr.hookargs['bundle2'] = '1' |
|
1304 | tr.hookargs['bundle2'] = '1' | |
1300 |
op = bundle2.bundleoperation(repo, lambda: tr |
|
1305 | op = bundle2.bundleoperation(repo, lambda: tr, | |
|
1306 | captureoutput=captureoutput) | |||
1301 | try: |
|
1307 | try: | |
1302 | r = bundle2.processbundle(repo, cg, op=op) |
|
1308 | r = bundle2.processbundle(repo, cg, op=op) | |
1303 | finally: |
|
1309 | finally: | |
1304 | r = op.reply |
|
1310 | r = op.reply | |
1305 | if r is not None: |
|
1311 | if captureoutput and r is not None: | |
1306 | repo.ui.pushbuffer(error=True, subproc=True) |
|
1312 | repo.ui.pushbuffer(error=True, subproc=True) | |
1307 | def recordout(output): |
|
1313 | def recordout(output): | |
1308 | r.newpart('output', data=output, mandatory=False) |
|
1314 | r.newpart('output', data=output, mandatory=False) | |
1309 | tr.close() |
|
1315 | tr.close() | |
1310 | except Exception, exc: |
|
1316 | except Exception, exc: | |
1311 | exc.duringunbundle2 = True |
|
1317 | exc.duringunbundle2 = True | |
1312 | if r is not None: |
|
1318 | if captureoutput and r is not None: | |
1313 | parts = exc._bundle2salvagedoutput = r.salvageoutput() |
|
1319 | parts = exc._bundle2salvagedoutput = r.salvageoutput() | |
1314 | def recordout(output): |
|
1320 | def recordout(output): | |
1315 | part = bundle2.bundlepart('output', data=output, |
|
1321 | part = bundle2.bundlepart('output', data=output, |
@@ -16,6 +16,7 b' enable obsolescence' | |||||
16 | > [experimental] |
|
16 | > [experimental] | |
17 | > evolution=createmarkers,exchange |
|
17 | > evolution=createmarkers,exchange | |
18 | > bundle2-exp=True |
|
18 | > bundle2-exp=True | |
|
19 | > bundle2-output-capture=True | |||
19 | > [ui] |
|
20 | > [ui] | |
20 | > ssh=python "$TESTDIR/dummyssh" |
|
21 | > ssh=python "$TESTDIR/dummyssh" | |
21 | > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline} |
|
22 | > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline} | |
@@ -667,3 +668,52 b' Check error from hook during the unbundl' | |||||
667 | remote: rollback completed |
|
668 | remote: rollback completed | |
668 | abort: pretxnchangegroup hook exited with status 1 |
|
669 | abort: pretxnchangegroup hook exited with status 1 | |
669 | [255] |
|
670 | [255] | |
|
671 | ||||
|
672 | Check output capture control. | |||
|
673 | ||||
|
674 | (should be still forced for http, disabled for local and ssh) | |||
|
675 | ||||
|
676 | $ cat >> $HGRCPATH << EOF | |||
|
677 | > [experimental] | |||
|
678 | > bundle2-output-capture=False | |||
|
679 | > EOF | |||
|
680 | ||||
|
681 | $ hg -R main push other -r e7ec4e813ba6 | |||
|
682 | pushing to other | |||
|
683 | searching for changes | |||
|
684 | adding changesets | |||
|
685 | adding manifests | |||
|
686 | adding file changes | |||
|
687 | added 1 changesets with 1 changes to 1 files | |||
|
688 | Fail early! | |||
|
689 | transaction abort! | |||
|
690 | Cleaning up the mess... | |||
|
691 | rollback completed | |||
|
692 | abort: pretxnchangegroup hook exited with status 1 | |||
|
693 | [255] | |||
|
694 | $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 | |||
|
695 | pushing to ssh://user@dummy/other | |||
|
696 | searching for changes | |||
|
697 | abort: pretxnchangegroup hook exited with status 1 | |||
|
698 | remote: adding changesets | |||
|
699 | remote: adding manifests | |||
|
700 | remote: adding file changes | |||
|
701 | remote: added 1 changesets with 1 changes to 1 files | |||
|
702 | remote: Fail early! | |||
|
703 | remote: transaction abort! | |||
|
704 | remote: Cleaning up the mess... | |||
|
705 | remote: rollback completed | |||
|
706 | [255] | |||
|
707 | $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6 | |||
|
708 | pushing to http://localhost:$HGPORT2/ | |||
|
709 | searching for changes | |||
|
710 | remote: adding changesets | |||
|
711 | remote: adding manifests | |||
|
712 | remote: adding file changes | |||
|
713 | remote: added 1 changesets with 1 changes to 1 files | |||
|
714 | remote: Fail early! | |||
|
715 | remote: transaction abort! | |||
|
716 | remote: Cleaning up the mess... | |||
|
717 | remote: rollback completed | |||
|
718 | abort: pretxnchangegroup hook exited with status 1 | |||
|
719 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now