Mercurial > hg-stable
changeset 9647:f69fd20d788d
patchbomb: fix double-spaces in prompts
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Sun, 25 Oct 2009 14:24:39 +0100 |
parents | 5b001f534452 |
children | 6064de41b7e4 |
files | hgext/patchbomb.py tests/test-patchbomb.out |
diffstat | 2 files changed, 8 insertions(+), 7 deletions(-) [+] |
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'):
--- 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.