diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -1298,12 +1298,15 @@ def unbundle(repo, cg, heads, source, ur tr.hookargs['url'] = url tr.hookargs['bundle2'] = '1' r = bundle2.processbundle(repo, cg, lambda: tr).reply + if 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: parts = exc._bundle2salvagedoutput = r.salvageoutput() - repo.ui.pushbuffer(error=True, subproc=True) def recordout(output): part = bundle2.bundlepart('output', data=output, mandatory=False) 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 @@ -212,20 +212,20 @@ push $ hg -R main push other --rev eea13746799a --bookmark book_eea1 pushing to other searching for changes - pre-close-tip:eea13746799a public book_eea1 - pushkey: lock state after "phases" - lock: free - wlock: free - pushkey: lock state after "bookmarks" - lock: free - wlock: free - postclose-tip:eea13746799a public book_eea1 - txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_TXNID=TXN:* HG_TXNNAME=push HG_URL=push (glob) remote: adding changesets remote: adding manifests remote: adding file changes remote: added 1 changesets with 0 changes to 0 files (-1 heads) remote: 1 new obsolescence markers + remote: pre-close-tip:eea13746799a public book_eea1 + remote: pushkey: lock state after "phases" + remote: lock: free + remote: wlock: free + remote: pushkey: lock state after "bookmarks" + remote: lock: free + remote: wlock: free + remote: postclose-tip:eea13746799a public book_eea1 + remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_TXNID=TXN:* HG_TXNNAME=push HG_URL=push (glob) updating bookmark book_eea1 pre-close-tip:02de42196ebe draft book_02de postclose-tip:02de42196ebe draft book_02de @@ -304,13 +304,13 @@ push over ssh remote: adding file changes remote: added 1 changesets with 1 changes to 1 files remote: 1 new obsolescence markers - updating bookmark book_5fdd remote: pre-close-tip:5fddd98957c8 draft book_5fdd remote: pushkey: lock state after "bookmarks" remote: lock: free remote: wlock: free remote: postclose-tip:5fddd98957c8 draft book_5fdd remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_TXNID=TXN:* HG_TXNNAME=serve HG_URL=remote:ssh:127.0.0.1 (glob) + updating bookmark book_5fdd pre-close-tip:02de42196ebe draft book_02de postclose-tip:02de42196ebe draft book_02de txnclose hook: HG_SOURCE=push-response HG_TXNID=TXN:* HG_TXNNAME=push-response (glob) @@ -355,6 +355,15 @@ push over http remote: adding file changes remote: added 1 changesets with 1 changes to 1 files remote: 1 new obsolescence markers + remote: pre-close-tip:32af7686d403 public book_32af + remote: pushkey: lock state after "phases" + remote: lock: free + remote: wlock: free + remote: pushkey: lock state after "bookmarks" + remote: lock: free + remote: wlock: free + remote: postclose-tip:32af7686d403 public book_32af + remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_NEW_OBSMARKERS=1 HG_NODE=32af7686d403cf45b5d95f2d70cebea587ac806a HG_PHASES_MOVED=1 HG_SOURCE=serve HG_TXNID=TXN:* HG_TXNNAME=serve HG_URL=remote:http:127.0.0.1: (glob) updating bookmark book_32af pre-close-tip:02de42196ebe draft book_02de postclose-tip:02de42196ebe draft book_02de @@ -548,7 +557,7 @@ Doing the actual push: hook abort > [failpush] > reason = > [hooks] - > pretxnclose.failpush = false + > pretxnclose.failpush = echo "You shall not pass!"; false > txnabort.failpush = echo 'Cleaning up the mess...' > EOF @@ -559,11 +568,12 @@ Doing the actual push: hook abort $ hg -R main push other -r e7ec4e813ba6 pushing to other searching for changes - pre-close-tip:e7ec4e813ba6 draft remote: adding changesets remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files + remote: pre-close-tip:e7ec4e813ba6 draft + remote: You shall not pass! remote: transaction abort! remote: Cleaning up the mess... remote: rollback completed @@ -577,11 +587,12 @@ Doing the actual push: hook abort remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files + remote: pre-close-tip:e7ec4e813ba6 draft + remote: You shall not pass! remote: transaction abort! remote: Cleaning up the mess... remote: rollback completed abort: pretxnclose.failpush hook exited with status 1 - remote: pre-close-tip:e7ec4e813ba6 draft [255] $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6 @@ -591,6 +602,8 @@ Doing the actual push: hook abort remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files + remote: pre-close-tip:e7ec4e813ba6 draft + remote: You shall not pass! remote: transaction abort! remote: Cleaning up the mess... remote: rollback completed