##// END OF EJS Templates
patchbomb: attachment options changed...
Dennis Schoen -
r5819:89ea99c7 default
parent child Browse files
Show More
@@ -162,9 +162,10 b' def patchbomb(ui, repo, *revs, **opts):'
162 if not node:
162 if not node:
163 raise ValueError
163 raise ValueError
164
164
165 #body = ('\n'.join(desc[1:]).strip() or
165 if opts['attach']:
166 # 'Patch subject is complete summary.')
166 body = ('\n'.join(desc[1:]).strip() or
167 #body += '\n\n\n'
167 'Patch subject is complete summary.')
168 body += '\n\n\n'
168
169
169 if opts.get('plain'):
170 if opts.get('plain'):
170 while patch and patch[0].startswith('# '):
171 while patch and patch[0].startswith('# '):
@@ -175,7 +176,7 b' def patchbomb(ui, repo, *revs, **opts):'
175 patch.pop(0)
176 patch.pop(0)
176 if opts.get('diffstat'):
177 if opts.get('diffstat'):
177 body += cdiffstat('\n'.join(desc), patch) + '\n\n'
178 body += cdiffstat('\n'.join(desc), patch) + '\n\n'
178 if opts.get('attach'):
179 if opts.get('attach') or opts.get('inline'):
179 msg = email.MIMEMultipart.MIMEMultipart()
180 msg = email.MIMEMultipart.MIMEMultipart()
180 if body:
181 if body:
181 msg.attach(email.MIMEText.MIMEText(body, 'plain'))
182 msg.attach(email.MIMEText.MIMEText(body, 'plain'))
@@ -191,7 +192,10 b' def patchbomb(ui, repo, *revs, **opts):'
191 binnode, idx, total)
192 binnode, idx, total)
192 else:
193 else:
193 patchname = cmdutil.make_filename(repo, '%b.patch', binnode)
194 patchname = cmdutil.make_filename(repo, '%b.patch', binnode)
194 p['Content-Disposition'] = 'inline; filename=' + patchname
195 disposition = 'inline'
196 if opts['attach']:
197 disposition = 'attachment'
198 p['Content-Disposition'] = disposition + '; filename=' + patchname
195 msg.attach(p)
199 msg.attach(p)
196 else:
200 else:
197 body += '\n'.join(patch)
201 body += '\n'.join(patch)
@@ -430,7 +434,8 b' def patchbomb(ui, repo, *revs, **opts):'
430 cmdtable = {
434 cmdtable = {
431 "email":
435 "email":
432 (patchbomb,
436 (patchbomb,
433 [('a', 'attach', None, _('send patches as inline attachments')),
437 [('a', 'attach', None, _('send patches as attachments')),
438 ('i', 'inline', None, _('send patches as inline attachments')),
434 ('', 'bcc', [], _('email addresses of blind copy recipients')),
439 ('', 'bcc', [], _('email addresses of blind copy recipients')),
435 ('c', 'cc', [], _('email addresses of copy recipients')),
440 ('c', 'cc', [], _('email addresses of copy recipients')),
436 ('d', 'diffstat', None, _('add diffstat output to messages')),
441 ('d', 'diffstat', None, _('add diffstat output to messages')),
General Comments 0
You need to be logged in to leave comments. Login now