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>
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index 490d382..156c1ad 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -755,8 +755,12 @@
     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 @@
             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()