##// END OF EJS Templates
bundle2: also save output when error happens during part processing...
Pierre-Yves David -
r24851:df0ce98c stable
parent child Browse files
Show More
@@ -285,7 +285,7 b' def _notransaction():'
285 285 to be created"""
286 286 raise TransactionUnavailable()
287 287
288 def processbundle(repo, unbundler, transactiongetter=None):
288 def processbundle(repo, unbundler, transactiongetter=None, op=None):
289 289 """This function process a bundle, apply effect to/from a repo
290 290
291 291 It iterates over each part then searches for and uses the proper handling
@@ -295,7 +295,13 b' def processbundle(repo, unbundler, trans'
295 295 before final usage.
296 296
297 297 Unknown Mandatory part will abort the process.
298
299 It is temporarily possible to provide a prebuilt bundleoperation to the
300 function. This is used to ensure output is properly propagated in case of
301 an error during the unbundling. This output capturing part will likely be
302 reworked and this ability will probably go away in the process.
298 303 """
304 if op is None:
299 305 if transactiongetter is None:
300 306 transactiongetter = _notransaction
301 307 op = bundleoperation(repo, transactiongetter)
@@ -1297,7 +1297,11 b' def unbundle(repo, cg, heads, source, ur'
1297 1297 tr.hookargs['source'] = source
1298 1298 tr.hookargs['url'] = url
1299 1299 tr.hookargs['bundle2'] = '1'
1300 r = bundle2.processbundle(repo, cg, lambda: tr).reply
1300 op = bundle2.bundleoperation(repo, lambda: tr)
1301 try:
1302 r = bundle2.processbundle(repo, cg, op=op)
1303 finally:
1304 r = op.reply
1301 1305 if r is not None:
1302 1306 repo.ui.pushbuffer(error=True, subproc=True)
1303 1307 def recordout(output):
@@ -619,3 +619,51 b' Doing the actual push: hook abort'
619 619 $ ls -1 other/.hg/store/00changelog.i*
620 620 other/.hg/store/00changelog.i
621 621
622 Check error from hook during the unbundling process itself
623
624 $ cat << EOF >> $HGRCPATH
625 > pretxnchangegroup = echo "Fail early!"; false
626 > EOF
627 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS # reload http config
628 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
629 $ cat other.pid >> $DAEMON_PIDS
630
631 $ hg -R main push other -r e7ec4e813ba6
632 pushing to other
633 searching for changes
634 remote: adding changesets
635 remote: adding manifests
636 remote: adding file changes
637 remote: added 1 changesets with 1 changes to 1 files
638 remote: Fail early!
639 remote: transaction abort!
640 remote: Cleaning up the mess...
641 remote: rollback completed
642 abort: pretxnchangegroup hook exited with status 1
643 [255]
644 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
645 pushing to ssh://user@dummy/other
646 searching for changes
647 remote: adding changesets
648 remote: adding manifests
649 remote: adding file changes
650 remote: added 1 changesets with 1 changes to 1 files
651 remote: Fail early!
652 remote: transaction abort!
653 remote: Cleaning up the mess...
654 remote: rollback completed
655 abort: pretxnchangegroup hook exited with status 1
656 [255]
657 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
658 pushing to http://localhost:$HGPORT2/
659 searching for changes
660 remote: adding changesets
661 remote: adding manifests
662 remote: adding file changes
663 remote: added 1 changesets with 1 changes to 1 files
664 remote: Fail early!
665 remote: transaction abort!
666 remote: Cleaning up the mess...
667 remote: rollback completed
668 abort: pretxnchangegroup hook exited with status 1
669 [255]
General Comments 0
You need to be logged in to leave comments. Login now