[PATCH] patchbomb: use ui.promptchoice for diffstat to allow localization of choices (3rd try)

Christian Ebert blacktrash at gmx.net
Fri Sep 3 09:15:36 CDT 2010


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1283523139 -3600
# Node ID 8826ee11af61e2b1c1711266a44d88e89e7fbe96
# Parent  dfb11f9922c152bd74f5d827d89ec39f8749c1ad
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.

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -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
 
diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t
--- a/tests/test-patchbomb.t
+++ b/tests/test-patchbomb.t
@@ -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.
   


More information about the Mercurial-devel mailing list