aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--b4/submit.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/b4/submit.py b/b4/submit.py
index 9e28d9b..5622179 100644
--- a/b4/submit.py
+++ b/b4/submit.py
@@ -20,6 +20,8 @@ import subprocess
import shlex
import email
import pathlib
+import base64
+import textwrap
# from nacl.signing import SigningKey
# from nacl.encoding import Base64Encoder
@@ -486,8 +488,12 @@ def send(cover_commit: str, cmdargs: argparse.Namespace) -> None:
}
body = Template(cover_template.lstrip()).safe_substitute(tptvals)
cmsg = email.message.EmailMessage()
- cmsg.set_payload(body, charset='utf-8')
cmsg.add_header('Subject', csubject)
+ # Store tracking info in the header in a safe format, which should allow us to
+ # fully restore our work from the already sent series.
+ b64tracking = base64.b64encode(json.dumps(tracking).encode()).decode()
+ cmsg.add_header('X-b4-tracking', ' '.join(textwrap.wrap(b64tracking, width=78)))
+ cmsg.set_payload(body, charset='utf-8')
if cmdargs.prefixes:
prefixes = list(cmdargs.prefixes)
else: