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 <[email protected]>
---
 stgit/commands/mail.py       |  4 ++++
 templates/patchandattch.tmpl | 23 +++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 templates/patchandattch.tmpl

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-- 
-- 
1.7.11.7


_______________________________________________
stgit-users mailing list
[email protected]
https://mail.gna.org/listinfo/stgit-users

Reply via email to