From 41cded9122f22dcc4fe0b6c1bb8e4447dc3b31cd Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Mon, 18 Jul 2022 09:53:06 -0400 Subject: submit: store tracking info in the cover letter header Stick tracking info into the special header of the cover letter, which should allow us to fully recreate the branch from lore. Signed-off-by: Konstantin Ryabitsev --- b4/submit.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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: -- cgit v1.2.3