Linux maintainer tooling and workflows
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <thomas@t-8ch.de>
To: "Kernel.org Tools" <tools@linux.kernel.org>
Cc: "Konstantin Ryabitsev" <konstantin@linuxfoundation.org>,
	"Thomas Weißschuh" <thomas@t-8ch.de>
Subject: [PATCH b4 v2] ez: send: make argument to --resend optional
Date: Fri, 17 Feb 2023 03:58:58 +0000	[thread overview]
Message-ID: <20230217-resend-auto-version-v2-1-0830b9733993@t-8ch.de> (raw)

This frees the user from having to specifying an explicit version to
resend.
Most of the time this should be the latest version.

---


Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
---
Changes in v2:
- Correctly use last *sent* version, not current active one
- Link to v1: https://msgid.link/20230217-resend-auto-version-v1-1-e1db938d6fee@t-8ch.de
---
 b4/command.py |  2 +-
 b4/ez.py      | 10 ++++++++--
 man/b4.5      |  4 ++--
 man/b4.5.rst  |  4 ++--
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/b4/command.py b/b4/command.py
index a7a5aa91b2e6..b38d69ce2713 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -319,7 +319,7 @@ def setup_parser() -> argparse.ArgumentParser:
     sp_send.add_argument('--cc', nargs='+', help='Addresses to add to the Cc: list')
     sp_send.add_argument('--not-me-too', action='store_true', default=False,
                          help='Remove yourself from the To: or Cc: list')
-    sp_send.add_argument('--resend', metavar='vN', default=None,
+    sp_send.add_argument('--resend', metavar='vN', nargs='?', const='latest',
                          help='Resend a previously sent version of the series')
     sp_send.add_argument('--no-sign', action='store_true', default=False,
                          help='Do not add the cryptographic attestation signature header')
diff --git a/b4/ez.py b/b4/ez.py
index 74afddcbf614..625a27c2db2a 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -1257,10 +1257,16 @@ def cmd_send(cmdargs: argparse.Namespace) -> None:
     tag_msg = None
     cl_msgid = None
     if cmdargs.resend:
-        tagname, revision = get_sent_tagname(mybranch, SENT_TAG_PREFIX, cmdargs.resend)
+        if cmdargs.resend == 'latest':
+            cover, tracking = load_cover()
+            revstr = tracking['series']['revision'] - 1
+        else:
+            revstr = cmdargs.resend
+
+        tagname, revision = get_sent_tagname(mybranch, SENT_TAG_PREFIX, revstr)
 
         if revision is None:
-            logger.critical('Could not figure out revision from %s', cmdargs.resend)
+            logger.critical('Could not figure out revision from %s', revstr)
             sys.exit(1)
 
         try:
diff --git a/man/b4.5 b/man/b4.5
index fef1e87313c0..867ab35e6ebb 100644
--- a/man/b4.5
+++ b/man/b4.5
@@ -604,7 +604,7 @@ Enroll current branch, using the passed tag, branch, or commit as fork base
 .INDENT 0.0
 .TP
 .B usage:
-b4 send [\-h] [\-d] [\-o OUTPUT_DIR] [\-\-reflect] [\-\-no\-trailer\-to\-cc] [\-\-to TO [TO ...]] [\-\-cc CC [CC ...]] [\-\-not\-me\-too] [\-\-resend RESEND] [\-\-no\-sign] [\-\-web\-auth\-new] [\-\-web\-auth\-verify VERIFY_TOKEN]
+b4 send [\-h] [\-d] [\-o OUTPUT_DIR] [\-\-reflect] [\-\-no\-trailer\-to\-cc] [\-\-to TO [TO ...]] [\-\-cc CC [CC ...]] [\-\-not\-me\-too] [\-\-resend [RESEND]] [\-\-no\-sign] [\-\-web\-auth\-new] [\-\-web\-auth\-verify VERIFY_TOKEN]
 .TP
 .B options:
 .INDENT 7.0
@@ -637,7 +637,7 @@ Addresses to add to the Cc: list
 .B  \-\-not\-me\-too
 Remove yourself from the To: or Cc: list
 .TP
-.BI \-\-resend \ RESEND
+.BI \-\-resend \ [RESEND]
 Resend a previously sent version of the series
 .TP
 .B  \-\-no\-sign
diff --git a/man/b4.5.rst b/man/b4.5.rst
index 31beae44cefd..3b442c91aafb 100644
--- a/man/b4.5.rst
+++ b/man/b4.5.rst
@@ -390,7 +390,7 @@ Enroll existing branch:
 b4 send
 ~~~~~~~
 usage:
-  b4 send [-h] [-d] [-o OUTPUT_DIR] [--reflect] [--no-trailer-to-cc] [--to TO [TO ...]] [--cc CC [CC ...]] [--not-me-too] [--resend RESEND] [--no-sign] [--web-auth-new] [--web-auth-verify VERIFY_TOKEN]
+  b4 send [-h] [-d] [-o OUTPUT_DIR] [--reflect] [--no-trailer-to-cc] [--to TO [TO ...]] [--cc CC [CC ...]] [--not-me-too] [--resend [RESEND]] [--no-sign] [--web-auth-new] [--web-auth-verify VERIFY_TOKEN]
 
 options:
   -h, --help            show this help message and exit
@@ -411,7 +411,7 @@ options:
 
   --not-me-too
                         Remove yourself from the To: or Cc: list
-  --resend RESEND
+  --resend [RESEND]
                         Resend a previously sent version of the series
   --no-sign
                         Do not add the cryptographic attestation signature header

---
base-commit: ada3021c64dd484e53219eb3af55da6c8f25d0ec
change-id: 20230217-resend-auto-version-acb4bbcb4d81

Best regards,
-- 
Thomas Weißschuh <thomas@t-8ch.de>


             reply	other threads:[~2023-02-17  3:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17  3:58 Thomas Weißschuh [this message]
2023-03-03 20:09 ` [PATCH b4 v2] ez: send: make argument to --resend optional Konstantin Ryabitsev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230217-resend-auto-version-v2-1-0830b9733993@t-8ch.de \
    --to=thomas@t-8ch.de \
    --cc=konstantin@linuxfoundation.org \
    --cc=tools@linux.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).