Mercurial > hg-stable
changeset 24850:6b81309d15a7 stable
bundle2: capture output issue during transaction close
We were capturing all output issue during bundle2 processing, and all output
issue during transaction rollback in case of failure. However, the output issue
during transaction commit was still roaming the land freely. It is now put back
in line.
This let the user see output from 'pretxnclose' and 'txnclose' (and related) in
the right order.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 23 Apr 2015 14:54:45 +0100 |
parents | aff2aca3420e |
children | df0ce98c882f |
files | mercurial/exchange.py tests/test-bundle2-exchange.t |
diffstat | 2 files changed, 30 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/exchange.py Thu Apr 23 17:03:58 2015 +0100 +++ b/mercurial/exchange.py Thu Apr 23 14:54:45 2015 +0100 @@ -1298,12 +1298,15 @@ 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)
--- a/tests/test-bundle2-exchange.t Thu Apr 23 17:03:58 2015 +0100 +++ b/tests/test-bundle2-exchange.t Thu Apr 23 14:54:45 2015 +0100 @@ -212,20 +212,20 @@ $ 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 @@ 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 @@ 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 @@ > [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 @@ $ 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 @@ 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 @@ 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