Show More
@@ -265,6 +265,15 def patchbomb(ui, repo, *revs, **opts): | |||||
265 | def genmsgid(id): |
|
265 | def genmsgid(id): | |
266 | return '<%s.%s@%s>' % (id[:20], int(start_time[0]), socket.getfqdn()) |
|
266 | return '<%s.%s@%s>' % (id[:20], int(start_time[0]), socket.getfqdn()) | |
267 |
|
267 | |||
|
268 | def getdescription(body, sender): | |||
|
269 | if opts['desc']: | |||
|
270 | body = open(opts['desc']).read() | |||
|
271 | else: | |||
|
272 | ui.write(_('\nWrite the introductory message for the ' | |||
|
273 | 'patch series.\n\n')) | |||
|
274 | body = ui.edit(body, sender) | |||
|
275 | return body | |||
|
276 | ||||
268 | def getexportmsgs(): |
|
277 | def getexportmsgs(): | |
269 | patches = [] |
|
278 | patches = [] | |
270 |
|
279 | |||
@@ -310,13 +319,7 def patchbomb(ui, repo, *revs, **opts): | |||||
310 | d = cdiffstat(_('Final summary:\n'), jumbo) |
|
319 | d = cdiffstat(_('Final summary:\n'), jumbo) | |
311 | if d: body = '\n' + d |
|
320 | if d: body = '\n' + d | |
312 |
|
321 | |||
313 | if opts['desc']: |
|
322 | body = getdescription(body, sender) | |
314 | body = open(opts['desc']).read() |
|
|||
315 | else: |
|
|||
316 | ui.write(_('\nWrite the introductory message for the ' |
|
|||
317 | 'patch series.\n\n')) |
|
|||
318 | body = ui.edit(body, sender) |
|
|||
319 |
|
||||
320 | msg = email.MIMEText.MIMEText(body) |
|
323 | msg = email.MIMEText.MIMEText(body) | |
321 | msg['Subject'] = subj |
|
324 | msg['Subject'] = subj | |
322 |
|
325 | |||
@@ -326,9 +329,8 def patchbomb(ui, repo, *revs, **opts): | |||||
326 | def getbundlemsgs(bundle): |
|
329 | def getbundlemsgs(bundle): | |
327 | subj = (opts['subject'] |
|
330 | subj = (opts['subject'] | |
328 | or prompt('Subject:', default='A bundle for your repository')) |
|
331 | or prompt('Subject:', default='A bundle for your repository')) | |
329 | ui.write(_('\nWrite the introductory message for the bundle.\n\n')) |
|
|||
330 | body = ui.edit('', sender) |
|
|||
331 |
|
332 | |||
|
333 | body = getdescription('', sender) | |||
332 | msg = email.MIMEMultipart.MIMEMultipart() |
|
334 | msg = email.MIMEMultipart.MIMEMultipart() | |
333 | if body: |
|
335 | if body: | |
334 | msg.attach(email.MIMEText.MIMEText(body, 'plain')) |
|
336 | msg.attach(email.MIMEText.MIMEText(body, 'plain')) |
@@ -1,20 +1,46 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
|
3 | fixheaders() | |||
|
4 | { | |||
|
5 | sed -e 's/\(Message-Id:.*@\).*/\1/' \ | |||
|
6 | -e 's/\(In-Reply-To:.*@\).*/\1/' \ | |||
|
7 | -e 's/===.*/===/' | |||
|
8 | } | |||
|
9 | ||||
3 | echo "[extensions]" >> $HGRCPATH |
|
10 | echo "[extensions]" >> $HGRCPATH | |
4 | echo "patchbomb=" >> $HGRCPATH |
|
11 | echo "patchbomb=" >> $HGRCPATH | |
5 |
|
12 | |||
6 | hg init |
|
13 | hg init t | |
|
14 | cd t | |||
7 | echo a > a |
|
15 | echo a > a | |
8 | hg commit -Ama -d '1 0' |
|
16 | hg commit -Ama -d '1 0' | |
9 |
|
17 | |||
10 | hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar tip | \ |
|
18 | hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar tip | \ | |
11 | sed -e 's/\(Message-Id:.*@\).*/\1/' |
|
19 | fixheaders | |
12 |
|
20 | |||
13 | echo b > b |
|
21 | echo b > b | |
14 | hg commit -Amb -d '2 0' |
|
22 | hg commit -Amb -d '2 0' | |
15 |
|
23 | |||
16 | hg email --date '1970-1-1 0:2' -n -f quux -t foo -c bar -s test 0:tip | \ |
|
24 | hg email --date '1970-1-1 0:2' -n -f quux -t foo -c bar -s test 0:tip | \ | |
17 | sed -e 's/\(Message-Id:.*@\).*/\1/' | \ |
|
25 | fixheaders | |
18 | sed -e 's/\(In-Reply-To:.*@\).*/\1/' |
|
|||
19 |
|
26 | |||
20 | hg email -m test.mbox -f quux -t foo -c bar -s test 0:tip |
|
27 | hg email -m test.mbox -f quux -t foo -c bar -s test 0:tip | |
|
28 | ||||
|
29 | cd .. | |||
|
30 | ||||
|
31 | hg clone -q t t2 | |||
|
32 | cd t2 | |||
|
33 | echo c > c | |||
|
34 | hg commit -Amc -d '3 0' | |||
|
35 | ||||
|
36 | cat > description <<EOF | |||
|
37 | a multiline | |||
|
38 | ||||
|
39 | description | |||
|
40 | EOF | |||
|
41 | ||||
|
42 | echo % test bundle and description | |||
|
43 | hg email --date '1970-1-1 0:3' -n -f quux -t foo \ | |||
|
44 | -c bar -s test -r tip -b --desc description | \ | |||
|
45 | fixheaders | |||
|
46 |
@@ -107,3 +107,40 Write the introductory message for the p | |||||
107 | Writing [PATCH 0 of 2] test ... |
|
107 | Writing [PATCH 0 of 2] test ... | |
108 | Writing [PATCH 1 of 2] a ... |
|
108 | Writing [PATCH 1 of 2] a ... | |
109 | Writing [PATCH 2 of 2] b ... |
|
109 | Writing [PATCH 2 of 2] b ... | |
|
110 | adding c | |||
|
111 | % test bundle and description | |||
|
112 | searching for changes | |||
|
113 | ||||
|
114 | Displaying test ... | |||
|
115 | Content-Type: multipart/mixed; boundary="=== | |||
|
116 | MIME-Version: 1.0 | |||
|
117 | Subject: test | |||
|
118 | Message-Id: <patchbomb.180@ | |||
|
119 | Date: Thu, 01 Jan 1970 00:03:00 +0000 | |||
|
120 | From: quux | |||
|
121 | To: foo | |||
|
122 | Cc: bar | |||
|
123 | ||||
|
124 | --=== | |||
|
125 | Content-Type: text/plain; charset="us-ascii" | |||
|
126 | MIME-Version: 1.0 | |||
|
127 | Content-Transfer-Encoding: 7bit | |||
|
128 | ||||
|
129 | a multiline | |||
|
130 | ||||
|
131 | description | |||
|
132 | ||||
|
133 | --=== | |||
|
134 | Content-Type: application/x-mercurial-bundle | |||
|
135 | MIME-Version: 1.0 | |||
|
136 | Content-Disposition: attachment; filename="bundle.hg" | |||
|
137 | Content-Transfer-Encoding: base64 | |||
|
138 | ||||
|
139 | SEcxMEJaaDkxQVkmU1nvR7I3AAAN////lFYQWj1/4HwRkdC/AywIAk0E4pfoSIIIgQCgGEQOcLAA | |||
|
140 | 2tA1VPyp4mkeoG0EaaPU0GTT1GjRiNPIg9CZGBqZ6UbU9J+KFU09DNUaGgAAAAAANAGgAAAAA1U8 | |||
|
141 | oGgAADQGgAANNANAAAAAAZipFLz3XoakCEQB3PVPyHJVi1iYkAAKQAZQGpQGZESInRnCFMqLDla2 | |||
|
142 | Bx3qfRQeA2N4lnzKkAmP8kR2asievLLXXebVU8Vg4iEBqcJNJAxIapSU6SM4888ZAciRG6MYAIEE | |||
|
143 | SlIBpFisgGkyRjX//TMtfcUAEsGu56+YnE1OlTZmzKm8BSu2rvo4rHAYYaadIFFuTy0LYgIkgLVD | |||
|
144 | sgVa2F19D1tx9+hgbAygLgQwaIqcDdgA4BjQgIiz/AEP72++llgDKhKducqodGE4B0ETqF3JFOFC | |||
|
145 | Q70eyNw= | |||
|
146 | --=== |
General Comments 0
You need to be logged in to leave comments.
Login now