# HG changeset patch # User Martin Geisler # Date 1256477079 -3600 # Node ID f69fd20d788d99e17c50ff4a64669b22b753c0b1 # Parent 5b001f534452b65e8f16bde2a5a9bdb70ed33932 patchbomb: fix double-spaces in prompts diff -r 5b001f534452 -r f69fd20d788d hgext/patchbomb.py --- 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'): diff -r 5b001f534452 -r f69fd20d788d tests/test-patchbomb.out --- a/tests/test-patchbomb.out Sun Oct 25 13:27:54 2009 +0100 +++ b/tests/test-patchbomb.out Sun Oct 25 14:24:39 2009 +0100 @@ -1177,7 +1177,7 @@ +ff2c9fa2018b15fa74b33363bda9527323e2a99f two +ff2c9fa2018b15fa74b33363bda9527323e2a99f two.diff -abort: Subject:[PATCH 0 of 2] Please enter a valid value +abort: Subject: [PATCH 0 of 2] Please enter a valid value This patch series consists of 2 patches. This patch series consists of 2 patches.