aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>2012-08-28 11:09:19 -0700
committerPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>2013-01-08 22:24:33 -0800
commitbcb2361ab86abb535ac8d3b07df39c42f03c6c48 (patch)
treec5c35f5f05d7a587e5181ba48c8d47dc8ba7b786
parent3faf60c3745a708abad2167e29b8dd8da0e7d7cd (diff)
downloadstgit-bcb2361ab86abb535ac8d3b07df39c42f03c6c48.tar.gz
stgit: Add support for attaching patches and sending them inline
Add a new mail command and mail template to send patches both as an attachment plus inline in the mail. Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
-rw-r--r--stgit/commands/mail.py4
-rw-r--r--templates/patchandattch.tmpl23
2 files changed, 27 insertions, 0 deletions
diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
index 7f972a4..76ad664 100644
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -114,6 +114,8 @@ options = [
short = 'Send patches without sequence numbering'),
opt('--attach', action = 'store_true',
short = 'Send a patch as attachment'),
+ opt('--attach-inline', action = 'store_true',
+ short = 'Send a patch inline and as an attachment'),
opt('-v', '--version', metavar = 'VERSION',
short = 'Add VERSION to the [PATCH ...] prefix'),
opt('--prefix', metavar = 'PREFIX',
@@ -704,6 +706,8 @@ def func(parser, options, args):
else:
if options.attach:
tmpl = templates.get_template('mailattch.tmpl')
+ elif options.attach_inline:
+ tmpl = templates.get_template('patchandattch.tmpl')
else:
tmpl = templates.get_template('patchmail.tmpl')
if not tmpl:
diff --git a/templates/patchandattch.tmpl b/templates/patchandattch.tmpl
new file mode 100644
index 0000000..8393397
--- /dev/null
+++ b/templates/patchandattch.tmpl
@@ -0,0 +1,23 @@
+From: %(sender)s
+Subject: [%(prefix)sPATCH%(version)s%(number)s] %(shortdescr)s
+Mime-Version: 1.0
+Content-Type: multipart/mixed; boundary=MIMEBOUNDARY
+
+This is a MIME message.
+
+--MIMEBOUNDARY
+Content-Type: text/plain
+Content-Disposition: inline
+
+%(fromauth)s%(longdescr)s
+---
+%(diffstat)s
+%(diff)s
+---
+%(diffstat)s
+--MIMEBOUNDARY
+Content-Type: text/plain; name=%(patch)s.patch
+Content-Disposition: attachment; filename=%(patch)s.patch
+
+%(diff)s
+--MIMEBOUNDARY--