Show More
@@ -43,6 +43,15 b' to be a sendmail compatible mailer or fi' | |||||
43 | that the patchbomb extension can automatically send patchbombs |
|
43 | that the patchbomb extension can automatically send patchbombs | |
44 | directly from the commandline. See the [email] and [smtp] sections in |
|
44 | directly from the commandline. See the [email] and [smtp] sections in | |
45 | hgrc(5) for details. |
|
45 | hgrc(5) for details. | |
|
46 | ||||
|
47 | You can control the default inclusion of an introduction message with the | |||
|
48 | ``patchbomb.intro`` configuration option. The configuration is always | |||
|
49 | overwritten by command line flags like --intro and --desc:: | |||
|
50 | ||||
|
51 | [patchbomb] | |||
|
52 | intro=auto # include introduction message if more than 1 patch (default) | |||
|
53 | intro=never # never include an introduction message | |||
|
54 | intro=always # always include an introduction message | |||
46 | ''' |
|
55 | ''' | |
47 |
|
56 | |||
48 | import os, errno, socket, tempfile, cStringIO |
|
57 | import os, errno, socket, tempfile, cStringIO | |
@@ -66,9 +75,23 b' def prompt(ui, prompt, default=None, res' | |||||
66 | prompt += ' [%s]' % default |
|
75 | prompt += ' [%s]' % default | |
67 | return ui.prompt(prompt + rest, default) |
|
76 | return ui.prompt(prompt + rest, default) | |
68 |
|
77 | |||
69 | def introwanted(opts, number): |
|
78 | def introwanted(ui, opts, number): | |
70 | '''is an introductory message apparently wanted?''' |
|
79 | '''is an introductory message apparently wanted?''' | |
71 | return number > 1 or opts.get('intro') or opts.get('desc') |
|
80 | introconfig = ui.config('patchbomb', 'intro', 'auto') | |
|
81 | if opts.get('intro') or opts.get('desc'): | |||
|
82 | intro = True | |||
|
83 | elif introconfig == 'always': | |||
|
84 | intro = True | |||
|
85 | elif introconfig == 'never': | |||
|
86 | intro = False | |||
|
87 | elif introconfig == 'auto': | |||
|
88 | intro = 1 < number | |||
|
89 | else: | |||
|
90 | ui.write_err(_('warning: invalid patchbomb.intro value "%s"\n') | |||
|
91 | % introconfig) | |||
|
92 | ui.write_err(_('(should be one of always, never, auto)\n')) | |||
|
93 | intro = 1 < number | |||
|
94 | return intro | |||
72 |
|
95 | |||
73 | def makepatch(ui, repo, patchlines, opts, _charsets, idx, total, numbered, |
|
96 | def makepatch(ui, repo, patchlines, opts, _charsets, idx, total, numbered, | |
74 | patchname=None): |
|
97 | patchname=None): | |
@@ -287,7 +310,7 b' def _getpatchmsgs(repo, sender, patches,' | |||||
287 | % len(patches)) |
|
310 | % len(patches)) | |
288 |
|
311 | |||
289 | # build the intro message, or skip it if the user declines |
|
312 | # build the intro message, or skip it if the user declines | |
290 | if introwanted(opts, len(patches)): |
|
313 | if introwanted(ui, opts, len(patches)): | |
291 | msg = _makeintro(repo, sender, patches, **opts) |
|
314 | msg = _makeintro(repo, sender, patches, **opts) | |
292 | if msg: |
|
315 | if msg: | |
293 | msgs.append(msg) |
|
316 | msgs.append(msg) | |
@@ -407,7 +430,9 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
407 | for each patchbomb message, so you can verify everything is alright. |
|
430 | for each patchbomb message, so you can verify everything is alright. | |
408 |
|
431 | |||
409 | In case email sending fails, you will find a backup of your series |
|
432 | In case email sending fails, you will find a backup of your series | |
410 | introductory message in ``.hg/last-email.txt``. |
|
433 | introductory message in ``.hg/last-email.txt``. The inclusion the | |
|
434 | introduction can also be control using the ``patchbomb.intro`` option. (see | |||
|
435 | hg help patchbomb for details) | |||
411 |
|
436 | |||
412 | Examples:: |
|
437 | Examples:: | |
413 |
|
438 |
@@ -2663,4 +2663,127 b' dest#branch URIs:' | |||||
2663 | +d |
|
2663 | +d | |
2664 |
|
2664 | |||
2665 |
|
2665 | |||
2666 | $ cd .. |
|
2666 | Test introduction configuration | |
|
2667 | ================================= | |||
|
2668 | ||||
|
2669 | $ echo '[patchbomb]' >> $HGRCPATH | |||
|
2670 | ||||
|
2671 | "auto" setting | |||
|
2672 | ---------------- | |||
|
2673 | ||||
|
2674 | $ echo 'intro=auto' >> $HGRCPATH | |||
|
2675 | ||||
|
2676 | single rev | |||
|
2677 | ||||
|
2678 | $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '10' | grep "Write the introductory message for the patch series." | |||
|
2679 | [1] | |||
|
2680 | ||||
|
2681 | single rev + flag | |||
|
2682 | ||||
|
2683 | $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '10' --intro | grep "Write the introductory message for the patch series." | |||
|
2684 | Write the introductory message for the patch series. | |||
|
2685 | ||||
|
2686 | ||||
|
2687 | Multi rev | |||
|
2688 | ||||
|
2689 | $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '9::' | grep "Write the introductory message for the patch series." | |||
|
2690 | Write the introductory message for the patch series. | |||
|
2691 | ||||
|
2692 | "never" setting | |||
|
2693 | ----------------- | |||
|
2694 | ||||
|
2695 | $ echo 'intro=never' >> $HGRCPATH | |||
|
2696 | ||||
|
2697 | single rev | |||
|
2698 | ||||
|
2699 | $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '10' | grep "Write the introductory message for the patch series." | |||
|
2700 | [1] | |||
|
2701 | ||||
|
2702 | single rev + flag | |||
|
2703 | ||||
|
2704 | $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '10' --intro | grep "Write the introductory message for the patch series." | |||
|
2705 | Write the introductory message for the patch series. | |||
|
2706 | ||||
|
2707 | ||||
|
2708 | Multi rev | |||
|
2709 | ||||
|
2710 | $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '9::' | grep "Write the introductory message for the patch series." | |||
|
2711 | [1] | |||
|
2712 | ||||
|
2713 | Multi rev + flag | |||
|
2714 | ||||
|
2715 | $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '9::' --intro | grep "Write the introductory message for the patch series." | |||
|
2716 | Write the introductory message for the patch series. | |||
|
2717 | ||||
|
2718 | "always" setting | |||
|
2719 | ----------------- | |||
|
2720 | ||||
|
2721 | $ echo 'intro=always' >> $HGRCPATH | |||
|
2722 | ||||
|
2723 | single rev | |||
|
2724 | ||||
|
2725 | $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '10' | grep "Write the introductory message for the patch series." | |||
|
2726 | Write the introductory message for the patch series. | |||
|
2727 | ||||
|
2728 | single rev + flag | |||
|
2729 | ||||
|
2730 | $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '10' --intro | grep "Write the introductory message for the patch series." | |||
|
2731 | Write the introductory message for the patch series. | |||
|
2732 | ||||
|
2733 | ||||
|
2734 | Multi rev | |||
|
2735 | ||||
|
2736 | $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '9::' | grep "Write the introductory message for the patch series." | |||
|
2737 | Write the introductory message for the patch series. | |||
|
2738 | ||||
|
2739 | Multi rev + flag | |||
|
2740 | ||||
|
2741 | $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '9::' --intro | grep "Write the introductory message for the patch series." | |||
|
2742 | Write the introductory message for the patch series. | |||
|
2743 | ||||
|
2744 | bad value setting | |||
|
2745 | ----------------- | |||
|
2746 | ||||
|
2747 | $ echo 'intro=mpmwearaclownnose' >> $HGRCPATH | |||
|
2748 | ||||
|
2749 | single rev | |||
|
2750 | ||||
|
2751 | $ hg email --date '1980-1-1 0:1' -n -t foo -s test -r '10' | |||
|
2752 | From [test]: test | |||
|
2753 | this patch series consists of 1 patches. | |||
|
2754 | ||||
|
2755 | warning: invalid patchbomb.intro value "mpmwearaclownnose" | |||
|
2756 | (should be one of always, never, auto) | |||
|
2757 | Cc: | |||
|
2758 | ||||
|
2759 | displaying [PATCH] test ... | |||
|
2760 | Content-Type: text/plain; charset="us-ascii" | |||
|
2761 | MIME-Version: 1.0 | |||
|
2762 | Content-Transfer-Encoding: 7bit | |||
|
2763 | Subject: [PATCH] test | |||
|
2764 | X-Mercurial-Node: 3b6f1ec9dde933a40a115a7990f8b320477231af | |||
|
2765 | X-Mercurial-Series-Index: 1 | |||
|
2766 | X-Mercurial-Series-Total: 1 | |||
|
2767 | Message-Id: <3b6f1ec9dde933a40a11*> (glob) | |||
|
2768 | X-Mercurial-Series-Id: <3b6f1ec9dde933a40a11.*> (glob) | |||
|
2769 | User-Agent: Mercurial-patchbomb/* (glob) | |||
|
2770 | Date: Tue, 01 Jan 1980 00:01:00 +0000 | |||
|
2771 | From: test | |||
|
2772 | To: foo | |||
|
2773 | ||||
|
2774 | # HG changeset patch | |||
|
2775 | # User test | |||
|
2776 | # Date 5 0 | |||
|
2777 | # Thu Jan 01 00:00:05 1970 +0000 | |||
|
2778 | # Branch test | |||
|
2779 | # Node ID 3b6f1ec9dde933a40a115a7990f8b320477231af | |||
|
2780 | # Parent 2f9fa9b998c5fe3ac2bd9a2b14bfcbeecbc7c268 | |||
|
2781 | dd | |||
|
2782 | ||||
|
2783 | diff -r 2f9fa9b998c5 -r 3b6f1ec9dde9 d | |||
|
2784 | --- a/d Thu Jan 01 00:00:04 1970 +0000 | |||
|
2785 | +++ b/d Thu Jan 01 00:00:05 1970 +0000 | |||
|
2786 | @@ -1,1 +1,2 @@ | |||
|
2787 | d | |||
|
2788 | +d | |||
|
2789 |
General Comments 0
You need to be logged in to leave comments.
Login now