From patchwork Fri Oct 10 15:09:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4, of, 5, V2] ui: echo prompt choice only if formatted output is acceptable From: Yuya Nishihara X-Patchwork-Id: 6177 Message-Id: <6dcb36c1781c7afbdcee.1412953760@mimosa> To: mercurial-devel@selenic.com Date: Sat, 11 Oct 2014 00:09:20 +0900 # HG changeset patch # User Yuya Nishihara # Date 1412950877 -32400 # Fri Oct 10 23:21:17 2014 +0900 # Node ID 6dcb36c1781c7afbdcee20c793be20e90854e391 # Parent 80977d0b038a9a42a9b6819e77b80d343c1f711e ui: echo prompt choice only if formatted output is acceptable 9ab18a912c44 is nice for test output, but it also affects command-server clients or scripts that have to parse the output. So enables it only if formatted output is acceptable. This should cover most of command-server clients but chg. diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -684,7 +684,8 @@ class ui(object): r = default # sometimes self.interactive disagrees with isatty, # show response provided on stdin when simulating - if not self._isatty(self.fin): + # but not for commandserver and other scripting + if not self._isatty(self.fin) and self.formatted(): self.write(r, "\n") return r except EOFError: diff --git a/tests/test-diff-color.t b/tests/test-diff-color.t --- a/tests/test-diff-color.t +++ b/tests/test-diff-color.t @@ -69,6 +69,7 @@ diffstat $ cat <> $HGRCPATH > record = > [ui] + > formatted = true > interactive = true > [diff] > git = True diff --git a/tests/test-issue3084.t b/tests/test-issue3084.t --- a/tests/test-issue3084.t +++ b/tests/test-issue3084.t @@ -2,6 +2,8 @@ $ cat <> $HGRCPATH > [extensions] > largefiles = + > [ui] + > formatted = true > EOF Create the repository outside $HOME since largefiles write to diff --git a/tests/test-keyword.t b/tests/test-keyword.t --- a/tests/test-keyword.t +++ b/tests/test-keyword.t @@ -6,6 +6,7 @@ > record = > transplant = > [ui] + > formatted = true > interactive = true > EOF diff --git a/tests/test-largefiles-update.t b/tests/test-largefiles-update.t --- a/tests/test-largefiles-update.t +++ b/tests/test-largefiles-update.t @@ -3,6 +3,7 @@ directory (and ".hg/largefiles/dirstate" $ cat >> $HGRCPATH < [ui] + > formatted = true > merge = internal:fail > [extensions] > largefiles = diff --git a/tests/test-merge-prompt.t b/tests/test-merge-prompt.t --- a/tests/test-merge-prompt.t +++ b/tests/test-merge-prompt.t @@ -65,6 +65,7 @@ Interactive merge: $ cat <> $HGRCPATH > [ui] + > formatted = true > interactive = true > EOF diff --git a/tests/test-mq-qrefresh-interactive.t b/tests/test-mq-qrefresh-interactive.t --- a/tests/test-mq-qrefresh-interactive.t +++ b/tests/test-mq-qrefresh-interactive.t @@ -2,6 +2,7 @@ Create configuration $ cat <> $HGRCPATH > [ui] + > formatted = true > interactive = true > EOF diff --git a/tests/test-mq-subrepo.t b/tests/test-mq-subrepo.t --- a/tests/test-mq-subrepo.t +++ b/tests/test-mq-subrepo.t @@ -284,6 +284,7 @@ handle subrepos safely on qrecord $ mkrepo repo-2499-qrecord $ cat <> .hg/hgrc > [ui] + > formatted = true > interactive = true > EOF $ testadd qrecord -m0 0.diff < Mercurial-patc +a - $ hg --config ui.interactive=1 email --confirm -n -f quux -t foo -c bar -r tip< email --confirm -n -f quux -t foo -c bar -r tip < n > EOF this patch series consists of 1 patches. diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t --- a/tests/test-qrecord.t +++ b/tests/test-qrecord.t @@ -2,6 +2,7 @@ Create configuration $ cat <> $HGRCPATH > [ui] + > formatted = true > interactive = true > EOF diff --git a/tests/test-record.t b/tests/test-record.t --- a/tests/test-record.t +++ b/tests/test-record.t @@ -2,6 +2,7 @@ Set up a repo $ cat <> $HGRCPATH > [ui] + > formatted = true > interactive = true > [extensions] > record = diff --git a/tests/test-transplant.t b/tests/test-transplant.t --- a/tests/test-transplant.t +++ b/tests/test-transplant.t @@ -499,7 +499,8 @@ test interactive transplant |/ o 0:17ab29e464c6 - $ hg transplant -q --config ui.interactive=true -s ../t < -s ../t < p > y > n @@ -531,7 +532,8 @@ test interactive transplant |/ o 17ab29e464c6 - $ hg transplant -q --config ui.interactive=true -s ../t < -s ../t < x > ? > y