diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2022-07-18 09:53:06 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2022-07-18 09:55:37 -0400 |
commit | 41cded9122f22dcc4fe0b6c1bb8e4447dc3b31cd (patch) | |
tree | 9c0f6d7bda3a52f557e914992c84aca57a6676d2 | |
parent | eef190d827f3a87a23a2fc79f08aa96a147d0fa0 (diff) | |
download | b4-41cded9122f22dcc4fe0b6c1bb8e4447dc3b31cd.tar.gz |
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 <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/submit.py | 8 |
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: |