Mercurial > public > mercurial-scm > hg-stable
diff hgext/patchbomb.py @ 10734:7a0502a6f9a1
patchbomb: --desc implies --intro
For a single patch, an introductory text should not remain unsent
if --intro has been omitted, as the intent of --desc is clear.
author | C?dric Duval <cedricduval@free.fr> |
---|---|
date | Mon, 15 Mar 2010 22:37:38 +0100 |
parents | e764f24a45ee |
children | 49a07f441496 |
line wrap: on
line diff
--- a/hgext/patchbomb.py Thu Mar 18 14:36:24 2010 -0700 +++ b/hgext/patchbomb.py Mon Mar 15 22:37:38 2010 +0100 @@ -105,6 +105,10 @@ raise util.Abort(_('diffstat rejected')) return s +def introneeded(opts, number): + '''is an introductory message required?''' + return number > 1 or opts.get('intro') or opts.get('desc') + def makepatch(ui, repo, patch, opts, _charsets, idx, total, patchname=None): desc = [] @@ -170,7 +174,7 @@ flag = ' ' + flag subj = desc[0].strip().rstrip('. ') - if total == 1 and not opts.get('intro'): + if not introneeded(opts, total): subj = '[PATCH%s] %s' % (flag, opts.get('subject') or subj) else: tlen = len(str(total)) @@ -329,7 +333,7 @@ len(patches), name) msgs.append(msg) - if len(patches) > 1 or opts.get('intro'): + if introneeded(opts, len(patches)): tlen = len(str(len(patches))) flag = ' '.join(opts.get('flag'))