[PATCH] patch attachment options changed
Dennis Schoen
ds at 1d10t.de
Mon Dec 17 17:12:56 UTC 2007
# HG changeset patch
# User Dennis Schoen <dennis at epublica.de>
# Date 1197911016 -3600
# Node ID ffb6e73dc276c0929a41afa0c460dbc9fdfc16cc
# Parent 2079faccb4081c851c49a4634671b07e5f8f459d
patch attachment options changed.
'-a/--attach' send patches as attachment
'-i/--inline' sends patches as inline attachment (old behavior of -a/--attach)
diff -r 2079faccb408 -r ffb6e73dc276 hgext/patchbomb.py
--- a/hgext/patchbomb.py Mon Dec 17 13:45:30 2007 +0100
+++ b/hgext/patchbomb.py Mon Dec 17 18:03:36 2007 +0100
@@ -157,9 +157,10 @@ def patchbomb(ui, repo, *revs, **opts):
desc.append(line)
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['plain']:
while patch and patch[0].startswith('# '): patch.pop(0)
@@ -167,7 +168,7 @@ def patchbomb(ui, repo, *revs, **opts):
while patch and not patch[0].strip(): patch.pop(0)
if opts['diffstat']:
body += cdiffstat('\n'.join(desc), patch) + '\n\n'
- if opts['attach']:
+ if opts['attach'] or opts['inline']:
msg = email.MIMEMultipart.MIMEMultipart()
if body: msg.attach(email.MIMEText.MIMEText(body, 'plain'))
p = email.MIMEText.MIMEText('\n'.join(patch), 'x-patch')
@@ -182,7 +183,9 @@ def patchbomb(ui, repo, *revs, **opts):
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)
@@ -413,7 +416,8 @@ cmdtable = {
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')),
More information about the Mercurial-devel
mailing list