[Concept,05/11] patman: Use actual send count to determine likely_sent

Message ID 20260329150140.4095446-6-sjg@u-boot.org
State New
Headers
Series patman: Add workflow tracking for patch series |

Commit Message

Simon Glass March 29, 2026, 3:01 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Update send.py and func_test.py to handle the new (cmd, num_sent)
tuple returned by gitutil.email_patches(). Use num_sent > 0 instead
of the old heuristic, so workflow entries are only created when
patches were actually sent.

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

 tools/patman/func_test.py | 2 +-
 tools/patman/send.py      | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
  

Patch

diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index d029181765c..b1f37577643 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -230,7 +230,7 @@  class TestFunctional(unittest.TestCase, TestCommon):
             cc_file = series.MakeCcFile(process_tags, cover_fname,
                                         not ignore_bad_tags, add_maintainers,
                                         None, get_maintainer_script, alias)
-            cmd = gitutil.email_patches(
+            cmd, _ = gitutil.email_patches(
                 series, cover_fname, args, dry_run, not ignore_bad_tags,
                 cc_file, alias, in_reply_to=in_reply_to, thread=None)
             series.ShowActions(args, cmd, process_tags, alias)
diff --git a/tools/patman/send.py b/tools/patman/send.py
index eb9a8e0da2e..db7d1ae6e4e 100644
--- a/tools/patman/send.py
+++ b/tools/patman/send.py
@@ -99,8 +99,9 @@  def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
 
     # Email the patches out (giving the user time to check / cancel)
     cmd = ''
+    num_sent = 0
     if its_a_go:
-        cmd = gitutil.email_patches(
+        cmd, num_sent = gitutil.email_patches(
             series, cover_fname, patch_files, dry_run, not ignore_bad_tags,
             cc_file, alias=settings.alias, in_reply_to=in_reply_to,
             thread=thread, smtp_server=smtp_server, identity=identity,
@@ -115,7 +116,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
+    return cmd, num_sent
 
 
 def prepare_patches(col, branch, count, start, end, ignore_binary, signoff,
@@ -206,11 +207,11 @@  def send(args, git_dir=None, cwd=None):
         print(f"Using sendemail identity '{identity}'")
 
     its_a_go = ok or args.ignore_errors
-    cmd = email_patches(
+    cmd, num_sent = 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,
         identity=identity, cwd=cwd)
 
-    return cmd and its_a_go and not args.dry_run
+    return num_sent > 0