##// END OF EJS Templates
patchbomb: add option to send intro email for a single patch (issue1120)
Chris Winter -
r7360:42f1b8cb default
parent child Browse files
Show More
@@ -172,7 +172,7 b' def makepatch(ui, repo, patch, opts, _ch'
172 msg = mail.mimetextpatch(body, display=opts.get('test'))
172 msg = mail.mimetextpatch(body, display=opts.get('test'))
173
173
174 subj = desc[0].strip().rstrip('. ')
174 subj = desc[0].strip().rstrip('. ')
175 if total == 1:
175 if total == 1 and not opts.get('intro'):
176 subj = '[PATCH] ' + (opts.get('subject') or subj)
176 subj = '[PATCH] ' + (opts.get('subject') or subj)
177 else:
177 else:
178 tlen = len(str(total))
178 tlen = len(str(total))
@@ -316,7 +316,7 b' def patchbomb(ui, repo, *revs, **opts):'
316 len(patches), name)
316 len(patches), name)
317 msgs.append(msg)
317 msgs.append(msg)
318
318
319 if len(patches) > 1:
319 if len(patches) > 1 or opts.get('intro'):
320 tlen = len(str(len(patches)))
320 tlen = len(str(len(patches)))
321
321
322 subj = '[PATCH %0*d of %d] %s' % (
322 subj = '[PATCH %0*d of %d] %s' % (
@@ -481,6 +481,8 b' cmdtable = {'
481 _('run even when remote repository is unrelated (with -b)')),
481 _('run even when remote repository is unrelated (with -b)')),
482 ('', 'base', [],
482 ('', 'base', [],
483 _('a base changeset to specify instead of a destination (with -b)')),
483 _('a base changeset to specify instead of a destination (with -b)')),
484 ('', 'intro', None,
485 _('send an introduction email for a single patch')),
484 ] + emailopts + commands.remoteopts,
486 ] + emailopts + commands.remoteopts,
485 _('hg email [OPTION]... [DEST]...'))
487 _('hg email [OPTION]... [DEST]...'))
486 }
488 }
@@ -93,6 +93,14 b' echo "% test attach for multiple patches'
93 hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -s test -a 0:1 | \
93 hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -s test -a 0:1 | \
94 fixheaders
94 fixheaders
95
95
96 echo "% test intro for single patch"
97 hg email --date '1970-1-1 0:1' -n --intro -f quux -t foo -c bar -s test 2 | \
98 fixheaders
99
100 echo "% test intro for multiple patches"
101 hg email --date '1970-1-1 0:1' -n --intro -f quux -t foo -c bar -s test 0:1 | \
102 fixheaders
103
96 echo "% tagging csets"
104 echo "% tagging csets"
97 hg tag -r0 zero zero.foo
105 hg tag -r0 zero zero.foo
98 hg tag -r1 one one.patch
106 hg tag -r1 one one.patch
@@ -579,6 +579,122 b' diff -r 8580ff50825a -r 97d72e5f12c7 b'
579 +b
579 +b
580
580
581 --===
581 --===
582 % test intro for single patch
583 This patch series consists of 1 patches.
584
585
586 Write the introductory message for the patch series.
587
588
589 Displaying [PATCH 0 of 1] test ...
590 Content-Type: text/plain; charset="us-ascii"
591 MIME-Version: 1.0
592 Content-Transfer-Encoding: 7bit
593 Subject: [PATCH 0 of 1] test
594 Message-Id: <patchbomb.60@
595 Date: Thu, 01 Jan 1970 00:01:00 +0000
596 From: quux
597 To: foo
598 Cc: bar
599
600
601 Displaying [PATCH 1 of 1] c ...
602 Content-Type: text/plain; charset="us-ascii"
603 MIME-Version: 1.0
604 Content-Transfer-Encoding: 7bit
605 Subject: [PATCH 1 of 1] c
606 X-Mercurial-Node: ff2c9fa2018b15fa74b33363bda9527323e2a99f
607 Message-Id: <ff2c9fa2018b15fa74b3.61@
608 In-Reply-To: <patchbomb.60@
609 Date: Thu, 01 Jan 1970 00:01:01 +0000
610 From: quux
611 To: foo
612 Cc: bar
613
614 # HG changeset patch
615 # User test
616 # Date 3 0
617 # Node ID ff2c9fa2018b15fa74b33363bda9527323e2a99f
618 # Parent 97d72e5f12c7e84f85064aa72e5a297142c36ed9
619 c
620
621 diff -r 97d72e5f12c7 -r ff2c9fa2018b c
622 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
623 +++ b/c Thu Jan 01 00:00:03 1970 +0000
624 @@ -0,0 +1,1 @@
625 +c
626
627 % test intro for multiple patches
628 This patch series consists of 2 patches.
629
630
631 Write the introductory message for the patch series.
632
633
634 Displaying [PATCH 0 of 2] test ...
635 Content-Type: text/plain; charset="us-ascii"
636 MIME-Version: 1.0
637 Content-Transfer-Encoding: 7bit
638 Subject: [PATCH 0 of 2] test
639 Message-Id: <patchbomb.60@
640 Date: Thu, 01 Jan 1970 00:01:00 +0000
641 From: quux
642 To: foo
643 Cc: bar
644
645
646 Displaying [PATCH 1 of 2] a ...
647 Content-Type: text/plain; charset="us-ascii"
648 MIME-Version: 1.0
649 Content-Transfer-Encoding: 7bit
650 Subject: [PATCH 1 of 2] a
651 X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab
652 Message-Id: <8580ff50825a50c8f716.61@
653 In-Reply-To: <patchbomb.60@
654 Date: Thu, 01 Jan 1970 00:01:01 +0000
655 From: quux
656 To: foo
657 Cc: bar
658
659 # HG changeset patch
660 # User test
661 # Date 1 0
662 # Node ID 8580ff50825a50c8f716709acdf8de0deddcd6ab
663 # Parent 0000000000000000000000000000000000000000
664 a
665
666 diff -r 000000000000 -r 8580ff50825a a
667 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
668 +++ b/a Thu Jan 01 00:00:01 1970 +0000
669 @@ -0,0 +1,1 @@
670 +a
671
672 Displaying [PATCH 2 of 2] b ...
673 Content-Type: text/plain; charset="us-ascii"
674 MIME-Version: 1.0
675 Content-Transfer-Encoding: 7bit
676 Subject: [PATCH 2 of 2] b
677 X-Mercurial-Node: 97d72e5f12c7e84f85064aa72e5a297142c36ed9
678 Message-Id: <97d72e5f12c7e84f8506.62@
679 In-Reply-To: <patchbomb.60@
680 Date: Thu, 01 Jan 1970 00:01:02 +0000
681 From: quux
682 To: foo
683 Cc: bar
684
685 # HG changeset patch
686 # User test
687 # Date 2 0
688 # Node ID 97d72e5f12c7e84f85064aa72e5a297142c36ed9
689 # Parent 8580ff50825a50c8f716709acdf8de0deddcd6ab
690 b
691
692 diff -r 8580ff50825a -r 97d72e5f12c7 b
693 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
694 +++ b/b Thu Jan 01 00:00:02 1970 +0000
695 @@ -0,0 +1,1 @@
696 +b
697
582 % tagging csets
698 % tagging csets
583 % test inline for single named patch
699 % test inline for single named patch
584 This patch series consists of 1 patches.
700 This patch series consists of 1 patches.
General Comments 0
You need to be logged in to leave comments. Login now