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

Christian Ebert blacktrash at gmx.net
Mon Sep 6 14:49:57 CDT 2010


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1283801752 -7200
# Node ID 989d0f01b6571aba086805c0b3b13758929d8054
# Parent  74f54b7775f2fac7283f6f674822da0145e18dd1
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