[PATCH] patchbomb: use ui.promptchoice for diffstat to allow localization of choices (2nd try)
Christian Ebert
blacktrash at gmx.net
Thu Sep 2 17:06:21 CDT 2010
* Christian Ebert on Thursday, September 02, 2010 at 13:17:28 +0100
> # HG changeset patch
> # User Christian Ebert <blacktrash at gmx.net>
> # Date 1283429740 -3600
> # Node ID be3b7b99958005c0a7cdbf65ca81d48c581d231c
> # Parent be9c4131a8f4b9d90671ce13b151c3627ddb6904
> patchbomb: use ui.promptchoice for diffstat to allow localization of choices
>
> As in patchbomb's own prompt function we check for ui.interactive() before
> calling ui.promptchoice to avoid printing the message and default answer in
> non-interactive mode.
>
> Format boolean prompt as in filemerge.py.
>
> diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
> --- a/hgext/patchbomb.py
> +++ b/hgext/patchbomb.py
> @@ -101,8 +101,9 @@
> if summary:
> ui.write(summary, '\n')
> ui.write(s, '\n')
> - ans = prompt(ui, _('does the diffstat above look okay?'), 'y')
> - if not ans.lower().startswith('y'):
> + if (ui.interactive() and
> + ui.promptchoice(_('does the diffstat above look okay (yn)?'),
> + (_('&Yes'), ('&No')))):
> raise util.Abort(_('diffstat rejected'))
> return s
Why was the check for ui.interactive introduced for patchbomb
prompts in:
changeset: 5633:4d6b630d3939
user: Patrick Mezard <pmezard at gmail.com>
date: Mon Dec 10 22:41:18 2007 +0100
files: hgext/patchbomb.py
description:
patchbomb: prompt with ui.prompt()
Avoid Windows raw_input() issue introduced by a3fe91b4f6eb.
Found by Steve Borho <steve at borho.org>.
?
Even at the time ui.prompt had a check for ui.interactive.
c
--
\black\trash movie _SAME TIME SAME PLACE_
New York, in the summer of 2001
--->> http://www.blacktrash.org/underdogma/stsp.php
More information about the Mercurial-devel
mailing list