]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
patman: Update send function to return whether it sent
authorSimon Glass <sjg@chromium.org>
Sat, 10 May 2025 11:05:14 +0000 (13:05 +0200)
committerSimon Glass <sjg@chromium.org>
Tue, 27 May 2025 09:07:43 +0000 (10:07 +0100)
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@chromium.org>
tools/patman/send.py

index 009ea6bab5f1fe94a6e7ead1b6f137aa4c332a58..08a916aff1ada2cbe413b9128ffd65335776d08e 100644 (file)
@@ -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