Skip to contentSkip to conversation

upgrade-helper.py: add patches directly to AUH emails, in addition to attaching them as files

PATCH New Alexander Kanavin 1 participant 1 message Jun 12, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 upgrade-helper.py: add patches directly to AUH emails, in addition to attaching them as files

This utilizes the 'scissors' feature as described here

https://git-scm.com/docs/git-mailinfo#Documentation/git-mailinfo.txt---scissors

and allows easy handling of AUH emails with tools like b4, patchwork or even 'git am' directly, eliminating the need to get the attachment first.

---
 upgrade-helper.py | 4 ++++
 1 file changed, 4 insertions(+)
upgrade-helper.py +4 -0
index 4393589..4f0b6b7 100755
@@ -358,6 +358,10 @@ class Updater(object):
             attachment_fullpath = os.path.join(pkg_ctx['workdir'], attachment)
             if os.path.isfile(attachment_fullpath):
                 attachments.append(attachment_fullpath)
+                # Also add the patch inline using the 'scissors':
+                # https://git-scm.com/docs/git-mailinfo#Documentation/git-mailinfo.txt---scissors
+                if attachment_fullpath.endswith('.patch'):
+                    msg_body += "\n\n-- >8 --\n%s" % (open(attachment_fullpath).read())
 
         if self.opts['send_email']:
             self.email_handler.send_email(to_addr, subject, msg_body, attachments, cc_addr=cc_addr)
Signature · 1 line
2.30.2