patchbomb: attachment options changed
'-a/--attach' send patches as attachment
'-i/--inline' sends patches as inline attachment (old behavior of -a/--attach)
--- a/hgext/patchbomb.py Fri Jan 04 16:11:01 2008 +0100
+++ b/hgext/patchbomb.py Mon Dec 31 16:18:17 2007 +0100
@@ -162,9 +162,10 @@
if not node:
raise ValueError
- #body = ('\n'.join(desc[1:]).strip() or
- # 'Patch subject is complete summary.')
- #body += '\n\n\n'
+ if opts['attach']:
+ body = ('\n'.join(desc[1:]).strip() or
+ 'Patch subject is complete summary.')
+ body += '\n\n\n'
if opts.get('plain'):
while patch and patch[0].startswith('# '):
@@ -175,7 +176,7 @@
patch.pop(0)
if opts.get('diffstat'):
body += cdiffstat('\n'.join(desc), patch) + '\n\n'
- if opts.get('attach'):
+ if opts.get('attach') or opts.get('inline'):
msg = email.MIMEMultipart.MIMEMultipart()
if body:
msg.attach(email.MIMEText.MIMEText(body, 'plain'))
@@ -191,7 +192,10 @@
binnode, idx, total)
else:
patchname = cmdutil.make_filename(repo, '%b.patch', binnode)
- p['Content-Disposition'] = 'inline; filename=' + patchname
+ disposition = 'inline'
+ if opts['attach']:
+ disposition = 'attachment'
+ p['Content-Disposition'] = disposition + '; filename=' + patchname
msg.attach(p)
else:
body += '\n'.join(patch)
@@ -430,7 +434,8 @@
cmdtable = {
"email":
(patchbomb,
- [('a', 'attach', None, _('send patches as inline attachments')),
+ [('a', 'attach', None, _('send patches as attachments')),
+ ('i', 'inline', None, _('send patches as inline attachments')),
('', 'bcc', [], _('email addresses of blind copy recipients')),
('c', 'cc', [], _('email addresses of copy recipients')),
('d', 'diffstat', None, _('add diffstat output to messages')),