comparison hgext/patchbomb.py @ 12749:338b4b615d33

patchbomb: move command option help from the extension (patchbomb) to the command (email)
author timeless <timeless@gmail.com>
date Sun, 17 Oct 2010 14:00:01 +0300
parents 1ed2dc9d4368
children 6bf8d48bec8e
comparison
equal deleted inserted replaced
12748:d10369fefd01 12749:338b4b615d33
20 20
21 Each message refers to the first in the series using the In-Reply-To 21 Each message refers to the first in the series using the In-Reply-To
22 and References headers, so they will show up as a sequence in threaded 22 and References headers, so they will show up as a sequence in threaded
23 mail and news readers, and in mail archives. 23 mail and news readers, and in mail archives.
24 24
25 With the -d/--diffstat or -c/--confirm options, you will be presented
26 with a final summary of all messages and asked for confirmation before
27 the messages are sent.
28
29 To configure other defaults, add a section like this to your hgrc 25 To configure other defaults, add a section like this to your hgrc
30 file:: 26 file::
31 27
32 [email] 28 [email]
33 from = My Name <my@email> 29 from = My Name <my@email>
39 Use ``[patchbomb]`` as configuration section name if you need to 35 Use ``[patchbomb]`` as configuration section name if you need to
40 override global ``[email]`` address settings. 36 override global ``[email]`` address settings.
41 37
42 Then you can use the :hg:`email` command to mail a series of 38 Then you can use the :hg:`email` command to mail a series of
43 changesets as a patchbomb. 39 changesets as a patchbomb.
44
45 To avoid sending patches prematurely, it is a good idea to first run
46 the :hg:`email` command with the "-n" option (test only). You will be
47 prompted for an email recipient address, a subject and an introductory
48 message describing the patches of your patchbomb. Then when all is
49 done, patchbomb messages are displayed. If the PAGER environment
50 variable is set, your pager will be fired up once for each patchbomb
51 message, so you can verify everything is alright.
52
53 The -m/--mbox option is also very useful. Instead of previewing each
54 patchbomb message in a pager or sending the messages directly, it will
55 create a UNIX mailbox file with the patch emails. This mailbox file
56 can be previewed with any mail user agent which supports UNIX mbox
57 files, e.g. with mutt::
58
59 % mutt -R -f mbox
60
61 When you are previewing the patchbomb messages, you can use ``formail``
62 (a utility that is commonly installed as part of the procmail
63 package), to send each message out::
64
65 % formail -s sendmail -bm -t < mbox
66
67 That should be all. Now your patchbomb is on its way out.
68 40
69 You can also either configure the method option in the email section 41 You can also either configure the method option in the email section
70 to be a sendmail compatible mailer or fill out the [smtp] section so 42 to be a sendmail compatible mailer or fill out the [smtp] section so
71 that the patchbomb extension can automatically send patchbombs 43 that the patchbomb extension can automatically send patchbombs
72 directly from the commandline. See the [email] and [smtp] sections in 44 directly from the commandline. See the [email] and [smtp] sections in
182 of N]" introduction, which describes the series as a whole. 154 of N]" introduction, which describes the series as a whole.
183 155
184 Each patch email has a Subject line of "[PATCH M of N] ...", using 156 Each patch email has a Subject line of "[PATCH M of N] ...", using
185 the first line of the changeset description as the subject text. 157 the first line of the changeset description as the subject text.
186 The message contains two or three parts. First, the changeset 158 The message contains two or three parts. First, the changeset
187 description. Next, (optionally) if the diffstat program is 159 description.
188 installed and -d/--diffstat is used, the result of running 160
189 diffstat on the patch. Finally, the patch itself, as generated by 161 With the -d/--diffstat option, if the diffstat program is
190 :hg:`export`. 162 installed, the result of running diffstat on the patch is inserted.
163
164 Finally, the patch itself, as generated by :hg:`export`.
165
166 With the -d/--diffstat or -c/--confirm options, you will be presented
167 with a final summary of all messages and asked for confirmation before
168 the messages are sent.
191 169
192 By default the patch is included as text in the email body for 170 By default the patch is included as text in the email body for
193 easy reviewing. Using the -a/--attach option will instead create 171 easy reviewing. Using the -a/--attach option will instead create
194 an attachment for the patch. With -i/--inline an inline attachment 172 an attachment for the patch. With -i/--inline an inline attachment
195 will be created. 173 will be created.
200 178
201 With -b/--bundle, changesets are selected as for --outgoing, but a 179 With -b/--bundle, changesets are selected as for --outgoing, but a
202 single email containing a binary Mercurial bundle as an attachment 180 single email containing a binary Mercurial bundle as an attachment
203 will be sent. 181 will be sent.
204 182
183 With -m/--mbox, instead of previewing each patchbomb message in a
184 pager or sending the messages directly, it will create a UNIX
185 mailbox file with the patch emails. This mailbox file can be
186 previewed with any mail user agent which supports UNIX mbox
187 files.
188
189 With -n/--test, all steps will run, but mail will not be sent.
190 You will be prompted for an email recipient address, a subject and
191 an introductory message describing the patches of your patchbomb.
192 Then when all is done, patchbomb messages are displayed. If the
193 PAGER environment variable is set, your pager will be fired up once
194 for each patchbomb message, so you can verify everything is alright.
195
205 Examples:: 196 Examples::
206 197
207 hg email -r 3000 # send patch 3000 only 198 hg email -r 3000 # send patch 3000 only
208 hg email -r 3000 -r 3001 # send patches 3000 and 3001 199 hg email -r 3000 -r 3001 # send patches 3000 and 3001
209 hg email -r 3000:3005 # send patches 3000 through 3005 200 hg email -r 3000:3005 # send patches 3000 through 3005
216 207
217 hg email -b # send bundle of all patches not in default 208 hg email -b # send bundle of all patches not in default
218 hg email -b DEST # send bundle of all patches not in DEST 209 hg email -b DEST # send bundle of all patches not in DEST
219 hg email -b -r 3000 # bundle of all ancestors of 3000 not in default 210 hg email -b -r 3000 # bundle of all ancestors of 3000 not in default
220 hg email -b -r 3000 DEST # bundle of all ancestors of 3000 not in DEST 211 hg email -b -r 3000 DEST # bundle of all ancestors of 3000 not in DEST
212
213 hg email -o -m mbox && # generate an mbox file...
214 mutt -R -f mbox # ... and view it with mutt
215 hg email -o -m mbox && # generate an mbox file ...
216 formail -s sendmail \ # ... and use formail to send from the mbox
217 -bm -t < mbox # ... using sendmail
221 218
222 Before using this command, you will need to enable email in your 219 Before using this command, you will need to enable email in your
223 hgrc. See the [email] section in hgrc(5) for details. 220 hgrc. See the [email] section in hgrc(5) for details.
224 ''' 221 '''
225 222