diff hgext/patchbomb.py @ 9647:f69fd20d788d

patchbomb: fix double-spaces in prompts
author Martin Geisler <mg@lazybytes.net>
date Sun, 25 Oct 2009 14:24:39 +0100
parents d051db8e9e44
children 6064de41b7e4
line wrap: on
line diff
--- a/hgext/patchbomb.py	Sun Oct 25 13:27:54 2009 +0100
+++ b/hgext/patchbomb.py	Sun Oct 25 14:24:39 2009 +0100
@@ -76,11 +76,11 @@
 from mercurial.i18n import _
 from mercurial.node import bin
 
-def prompt(ui, prompt, default='', rest=': ', empty_ok=False):
+def prompt(ui, prompt, default='', rest=':', empty_ok=False):
     if not ui.interactive():
         if default or empty_ok:
             return default
-        raise util.Abort(_("%sPlease enter a valid value" % (prompt+rest)))
+        raise util.Abort(_("%s Please enter a valid value" % (prompt+rest)))
     if default:
         prompt += ' [%s]' % default
     prompt += rest
@@ -99,7 +99,7 @@
     if summary:
         ui.write(summary, '\n')
         ui.write(s, '\n')
-    ans = prompt(ui, _('does the diffstat above look okay? '), 'y')
+    ans = prompt(ui, _('does the diffstat above look okay?'), 'y')
     if not ans.lower().startswith('y'):
         raise util.Abort(_('diffstat rejected'))
     return s
@@ -330,10 +330,11 @@
 
             flag = ' '.join(opts.get('flag'))
             if flag:
-                subj = '[PATCH %0*d of %d %s] ' % (tlen, 0, len(patches), flag)
+                subj = '[PATCH %0*d of %d %s]' % (tlen, 0, len(patches), flag)
             else:
-                subj = '[PATCH %0*d of %d] ' % (tlen, 0, len(patches))
-            subj += opts.get('subject') or prompt(ui, 'Subject:', rest=subj)
+                subj = '[PATCH %0*d of %d]' % (tlen, 0, len(patches))
+            subj += ' ' + (opts.get('subject') or
+                           prompt(ui, 'Subject: ', rest=subj))
 
             body = ''
             if opts.get('diffstat'):