128 while patch and patch[0].startswith('# '): patch.pop(0) |
128 while patch and patch[0].startswith('# '): patch.pop(0) |
129 if patch: patch.pop(0) |
129 if patch: patch.pop(0) |
130 while patch and not patch[0].strip(): patch.pop(0) |
130 while patch and not patch[0].strip(): patch.pop(0) |
131 if opts['diffstat']: |
131 if opts['diffstat']: |
132 body += cdiffstat('\n'.join(desc), patch) + '\n\n' |
132 body += cdiffstat('\n'.join(desc), patch) + '\n\n' |
133 body += '\n'.join(patch) |
133 if opts['attach']: |
134 msg = email.MIMEText.MIMEText(body) |
134 msg = email.MIMEMultipart.MIMEMultipart() |
|
135 if body: msg.attach(email.MIMEText.MIMEText(body, 'plain')) |
|
136 msg.attach(email.MIMEText.MIMEText('\n'.join(patch), 'x-patch')) |
|
137 else: |
|
138 body += '\n'.join(patch) |
|
139 msg = email.MIMEText.MIMEText(body) |
135 if total == 1: |
140 if total == 1: |
136 subj = '[PATCH] ' + desc[0].strip() |
141 subj = '[PATCH] ' + desc[0].strip() |
137 else: |
142 else: |
138 subj = '[PATCH %d of %d] %s' % (idx, total, desc[0].strip()) |
143 subj = '[PATCH %d of %d] %s' % (idx, total, desc[0].strip()) |
139 if subj.endswith('.'): subj = subj[:-1] |
144 if subj.endswith('.'): subj = subj[:-1] |
272 mail.sendmail(sender, to + bcc + cc, m.as_string(0)) |
277 mail.sendmail(sender, to + bcc + cc, m.as_string(0)) |
273 |
278 |
274 cmdtable = { |
279 cmdtable = { |
275 'email': |
280 'email': |
276 (patchbomb, |
281 (patchbomb, |
277 [('', 'bcc', [], 'email addresses of blind copy recipients'), |
282 [('a', 'attach', None, 'send patches as inline attachments'), |
|
283 ('', 'bcc', [], 'email addresses of blind copy recipients'), |
278 ('c', 'cc', [], 'email addresses of copy recipients'), |
284 ('c', 'cc', [], 'email addresses of copy recipients'), |
279 ('d', 'diffstat', None, 'add diffstat output to messages'), |
285 ('d', 'diffstat', None, 'add diffstat output to messages'), |
280 ('f', 'from', '', 'email address of sender'), |
286 ('f', 'from', '', 'email address of sender'), |
281 ('', 'plain', None, 'omit hg patch header'), |
287 ('', 'plain', None, 'omit hg patch header'), |
282 ('n', 'test', None, 'print messages that would be sent'), |
288 ('n', 'test', None, 'print messages that would be sent'), |