# HG changeset patch # User Chris Winter # Date 1226567492 -3600 # Node ID 42f1b8cb9a606216d6ad733d9528e790b347f980 # Parent b0fa5dbd9cdd7e6caaa07c5b2acd42465e3c1298 patchbomb: add option to send intro email for a single patch (issue1120) diff -r b0fa5dbd9cdd -r 42f1b8cb9a60 hgext/patchbomb.py --- a/hgext/patchbomb.py Wed Nov 12 19:12:32 2008 +0100 +++ b/hgext/patchbomb.py Thu Nov 13 10:11:32 2008 +0100 @@ -172,7 +172,7 @@ msg = mail.mimetextpatch(body, display=opts.get('test')) subj = desc[0].strip().rstrip('. ') - if total == 1: + if total == 1 and not opts.get('intro'): subj = '[PATCH] ' + (opts.get('subject') or subj) else: tlen = len(str(total)) @@ -316,7 +316,7 @@ len(patches), name) msgs.append(msg) - if len(patches) > 1: + if len(patches) > 1 or opts.get('intro'): tlen = len(str(len(patches))) subj = '[PATCH %0*d of %d] %s' % ( @@ -481,6 +481,8 @@ _('run even when remote repository is unrelated (with -b)')), ('', 'base', [], _('a base changeset to specify instead of a destination (with -b)')), + ('', 'intro', None, + _('send an introduction email for a single patch')), ] + emailopts + commands.remoteopts, _('hg email [OPTION]... [DEST]...')) } diff -r b0fa5dbd9cdd -r 42f1b8cb9a60 tests/test-patchbomb --- a/tests/test-patchbomb Wed Nov 12 19:12:32 2008 +0100 +++ b/tests/test-patchbomb Thu Nov 13 10:11:32 2008 +0100 @@ -93,6 +93,14 @@ hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -s test -a 0:1 | \ fixheaders +echo "% test intro for single patch" +hg email --date '1970-1-1 0:1' -n --intro -f quux -t foo -c bar -s test 2 | \ + fixheaders + +echo "% test intro for multiple patches" +hg email --date '1970-1-1 0:1' -n --intro -f quux -t foo -c bar -s test 0:1 | \ + fixheaders + echo "% tagging csets" hg tag -r0 zero zero.foo hg tag -r1 one one.patch diff -r b0fa5dbd9cdd -r 42f1b8cb9a60 tests/test-patchbomb.out --- a/tests/test-patchbomb.out Wed Nov 12 19:12:32 2008 +0100 +++ b/tests/test-patchbomb.out Thu Nov 13 10:11:32 2008 +0100 @@ -579,6 +579,122 @@ +b --=== +% test intro for single patch +This patch series consists of 1 patches. + + +Write the introductory message for the patch series. + + +Displaying [PATCH 0 of 1] test ... +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [PATCH 0 of 1] test +Message-Id: