[PATCH 21/25] patman: Update send function to return whether it sent

Simon Glass sjg at chromium.org
Sat May 10 13:05:14 CEST 2025


Indicate whether 'git send-email' was actually called, so that we don't
bother waiting for patchwork to receive our series if it wasn't.

The 'git send-email' seems to always return a code of 0 even if nothing
was sent, so we cannot use clues there. Ideally we would watch the
output to determine which patches were sent and which not, but that is
left for another day.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/patman/send.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tools/patman/send.py b/tools/patman/send.py
index 009ea6bab5f..08a916aff1a 100644
--- a/tools/patman/send.py
+++ b/tools/patman/send.py
@@ -87,6 +87,9 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
             reply to cover-letter or first patch in series)
         smtp_server (str): SMTP server to use to send patches (None for default)
         cwd (str): Path to use for patch files (None to use current dir)
+
+    Return:
+        Git command that was/would be run
     """
     cc_file = series.MakeCcFile(process_tags, cover_fname, not ignore_bad_tags,
                                 add_maintainers, limit, get_maintainer_script,
@@ -109,6 +112,7 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
             print(col.build(col.RED, "Email would not be sent"))
 
     os.remove(cc_file)
+    return cmd
 
 
 def prepare_patches(col, branch, count, start, end, ignore_binary, signoff,
@@ -169,6 +173,9 @@ def send(args, git_dir=None, cwd=None):
     Args:
         args (argparse.Namespace): Arguments to patman
         cwd (str): Path to use for git operations
+
+    Return:
+        bool: True if the patches were likely sent, else False
     """
     col = terminal.Color()
     series, cover_fname, patch_files = prepare_patches(
@@ -181,8 +188,10 @@ def send(args, git_dir=None, cwd=None):
     ok = ok and gitutil.check_suppress_cc_config()
 
     its_a_go = ok or args.ignore_errors
-    email_patches(
+    cmd = email_patches(
         col, series, cover_fname, patch_files, args.process_tags,
         its_a_go, args.ignore_bad_tags, args.add_maintainers,
         args.get_maintainer_script, args.limit, args.dry_run,
         args.in_reply_to, args.thread, args.smtp_server, cwd=cwd)
+
+    return cmd and its_a_go and not args.dry_run
-- 
2.43.0



More information about the U-Boot mailing list