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

Mads Kiilerich mads at kiilerich.com
Thu Sep 2 06:54:29 CDT 2010


On 09/02/2010 12:54 PM, Christian Ebert wrote:
> # HG changeset patch
> # User Christian Ebert<blacktrash at gmx.net>
> # Date 1283424674 -3600
> # Node ID fc00c1b22b9d21070058f7b34c7b8432160747d5
> # Parent  be9c4131a8f4b9d90671ce13b151c3627ddb6904
> patchbomb: use ui.promptchoice for diffstat to allow localization of choices
>
> 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

This patch also introduces a check for ui.interactive() even though 
ui.promptchoice / ui.prompt already have checks for that. FWIW I still 
don't understand why, so I think that it at least deserves a comment in 
the description.

/Mads


More information about the Mercurial-devel mailing list