Mercurial > hg
comparison hgext/patchbomb.py @ 9612:d051db8e9e44
fix patchbomb prompt when sending series of patches
author | Alexander Solovyov <piranha@piranha.org.ua> |
---|---|
date | Mon, 19 Oct 2009 23:27:20 +0300 |
parents | bb3f8f692bc6 |
children | f69fd20d788d |
comparison
equal
deleted
inserted
replaced
9611:a3d73b3e1f8a | 9612:d051db8e9e44 |
---|---|
74 import email.Utils, email.Encoders, email.Generator | 74 import email.Utils, email.Encoders, email.Generator |
75 from mercurial import cmdutil, commands, hg, mail, patch, util | 75 from mercurial import cmdutil, commands, hg, mail, patch, util |
76 from mercurial.i18n import _ | 76 from mercurial.i18n import _ |
77 from mercurial.node import bin | 77 from mercurial.node import bin |
78 | 78 |
79 def prompt(ui, prompt, default=None, rest=': ', empty_ok=False): | 79 def prompt(ui, prompt, default='', rest=': ', empty_ok=False): |
80 if not ui.interactive(): | 80 if not ui.interactive(): |
81 return default | 81 if default or empty_ok: |
82 return default | |
83 raise util.Abort(_("%sPlease enter a valid value" % (prompt+rest))) | |
82 if default: | 84 if default: |
83 prompt += ' [%s]' % default | 85 prompt += ' [%s]' % default |
84 prompt += rest | 86 prompt += rest |
85 while True: | 87 while True: |
86 r = ui.prompt(prompt, default=default) | 88 r = ui.prompt(prompt, default=default) |
329 flag = ' '.join(opts.get('flag')) | 331 flag = ' '.join(opts.get('flag')) |
330 if flag: | 332 if flag: |
331 subj = '[PATCH %0*d of %d %s] ' % (tlen, 0, len(patches), flag) | 333 subj = '[PATCH %0*d of %d %s] ' % (tlen, 0, len(patches), flag) |
332 else: | 334 else: |
333 subj = '[PATCH %0*d of %d] ' % (tlen, 0, len(patches)) | 335 subj = '[PATCH %0*d of %d] ' % (tlen, 0, len(patches)) |
334 subj += opts.get('subject') or prompt(ui, 'Subject:', rest=subj, | 336 subj += opts.get('subject') or prompt(ui, 'Subject:', rest=subj) |
335 default='None') | |
336 | 337 |
337 body = '' | 338 body = '' |
338 if opts.get('diffstat'): | 339 if opts.get('diffstat'): |
339 d = cdiffstat(ui, _('Final summary:\n'), jumbo) | 340 d = cdiffstat(ui, _('Final summary:\n'), jumbo) |
340 if d: | 341 if d: |