[PATCH 1 of 1] patchbomb: use ui.promptchoice for diffstat to allow localization of choices

Mads Kiilerich mads at kiilerich.com
Thu Sep 2 17:00:15 CDT 2010


  Christian Ebert wrote, On 09/02/2010 05:43 PM:
> * On Thursday, September 02, 2010, you wrote:
>> On 09/02/2010 02:10 PM, Christian Ebert wrote:
>>> because ui.prompt has:
>>>
>>>         if not self.interactive():
>>>             self.write(msg, ' ', default, "\n")
>>>             return default
>>>
>>> i.e. it prints msg and default answer. This is not wanted in
>>> patchbomb.
>> FWIW, I still don't understand: Why?
>>
>> (http://mercurial.selenic.com/hg/hg/rev/01ada7b1861d)
> Well, I can counter that ;-) I don't understand the patch above.
> If it's just for testing, one can do
> "hg --config ui.interactive=1".  Why, in "normal usage" would I
> want to see the output I deliberately turned off?

As far as I know the purpose with the isatty checks is to make sure that 
Mercurial doesn't get stuck in an interactive prompt when it isn't run 
interactively. Mercurial thus makes a default answer to the prompts when 
not running interactive, but there is no fine-grained control and it 
isn't intended to be used for scripting. When looking at the output of a 
non-interactive session it is however very convenient to see what the 
default answer was and that it looks like an interactive session.

In other words: We don't want different behavior when running 
interactively and when running non-interactively. When there _has_ to be 
a difference because an interactive prompt doesn't make sense without a 
tty, then we prefer to show the prompt and show which answer we assumed, 
rather than hiding the prompt.

The ui.interactive setting is mainly intended to overrule isatty in 
special cases - especially for testing and "broken" "tty"s.  So 
ui.interactive do not mean "disable all prompts" but "don't ask the user 
interactively".

(It seems like the man page isn't completely right. The default for 
ui.interactive isn't True but "it depends".)

/Mads



More information about the Mercurial-devel mailing list