patchbomb: use ui.promptchoice for diffstat to allow localization of choices
authorChristian Ebert <blacktrash@gmx.net>
Wed, 08 Sep 2010 08:31:07 +0200
changeset 12196 e42bc7f66e25
parent 12195 ee41be2bbf5a
child 12197 540693065d40
patchbomb: use ui.promptchoice for diffstat to allow localization of choices The extra check for ui.interacive from patchbomb's prompt function is not needed here. Format boolean prompt as in filemerge.py.
hgext/patchbomb.py
tests/test-patchbomb.t
--- a/hgext/patchbomb.py	Fri Sep 03 23:34:37 2010 +0200
+++ b/hgext/patchbomb.py	Wed Sep 08 08:31:07 2010 +0200
@@ -101,8 +101,8 @@
     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.promptchoice(_('does the diffstat above look okay (yn)?'),
+                       (_('&Yes'), _('&No'))):
         raise util.Abort(_('diffstat rejected'))
     return s
 
--- a/tests/test-patchbomb.t	Fri Sep 03 23:34:37 2010 +0200
+++ b/tests/test-patchbomb.t	Wed Sep 08 08:31:07 2010 +0200
@@ -337,6 +337,7 @@
    c |  1 +
    1 files changed, 1 insertions(+), 0 deletions(-)
   
+  does the diffstat above look okay (yn)? y
   
   Displaying [PATCH] test ...
   Content-Type: text/plain; charset="us-ascii"
@@ -379,17 +380,20 @@
    a |  1 +
    1 files changed, 1 insertions(+), 0 deletions(-)
   
+  does the diffstat above look okay (yn)? y
   b
   
    b |  1 +
    1 files changed, 1 insertions(+), 0 deletions(-)
   
+  does the diffstat above look okay (yn)? y
   Final summary:
   
    a |  1 +
    b |  1 +
    2 files changed, 2 insertions(+), 0 deletions(-)
   
+  does the diffstat above look okay (yn)? y
   
   Write the introductory message for the patch series.