summaryrefslogtreecommitdiff
path: root/tools/patman/patchstream.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-02-27 12:27:30 -0700
committerTom Rini <trini@konsulko.com>2025-04-10 11:57:49 -0600
commit774e966f293c552f29a57d9ad7b620e6f334aad9 (patch)
tree39b069a23f767d732b233097218633b4c209249a /tools/patman/patchstream.py
parent206ca97fac5bc638b04b712075d8bb4656d79395 (diff)
patman: Show the base commit and branch
It is helpful to know which commit patches are based on, even if that commit might not be available to readers. Add a tag for this in the cover letter. Also add the local-branch name since that may be useful to the writer. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman/patchstream.py')
-rw-r--r--tools/patman/patchstream.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index 490d382045b..156c1ad0e32 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -755,8 +755,12 @@ def get_metadata(branch, start, count):
Returns:
Series: Object containing information about the commits.
"""
- return get_metadata_for_list(
- '%s~%d' % (branch if branch else 'HEAD', start), None, count)
+ top = f"{branch if branch else 'HEAD'}~{start}"
+ series = get_metadata_for_list(top, None, count)
+ series.base_commit = commit.Commit(gitutil.get_hash(f'{top}~{count}'))
+ series.branch = branch or gitutil.get_branch()
+ series.top = top
+ return series
def get_metadata_for_test(text):
"""Process metadata from a file containing a git log. Used for tests
@@ -868,4 +872,11 @@ def insert_cover_letter(fname, series, count):
out = series.MakeChangeLog(None)
line += '\n' + '\n'.join(out)
fil.write(line)
+
+ # Insert the base commit and branch
+ if series.base_commit:
+ print(f'base-commit: {series.base_commit.hash}', file=fil)
+ if series.branch:
+ print(f'branch: {series.branch}', file=fil)
+
fil.close()