From: Philippe Blain <levraiphilippeblain@gmail.com>
To: "Kernel.org Tools" <tools@linux.kernel.org>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
Philippe Blain <levraiphilippeblain@gmail.com>
Subject: [PATCH b4 1/2] mbox.py::make_am: simplify check for early return
Date: Sat, 15 Apr 2023 15:30:59 -0400 [thread overview]
Message-ID: <20230415-am-cherry-pick-suggestion-v1-1-8951a2274256@gmail.com> (raw)
In-Reply-To: <20230415-am-cherry-pick-suggestion-v1-0-8951a2274256@gmail.com>
In mbox.py::make_am, we check if the 'lser' LoreSeries returned by
lmbx.get_series is empty, and return early with a different critical
message depending on wether wantver was given or not.
Simplify the logic a bit by using a nested if instead of two subsequent
ones. This will make the following commit's diff simpler.
Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
b4/mbox.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/b4/mbox.py b/b4/mbox.py
index 7060564..05c40e9 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -57,11 +57,11 @@ def make_am(msgs: List[email.message.Message], cmdargs: argparse.Namespace, msgi
reroll = False
lser = lmbx.get_series(revision=wantver, sloppytrailers=cmdargs.sloppytrailers, reroll=reroll)
- if lser is None and wantver is None:
- logger.critical('No patches found.')
- return
if lser is None:
- logger.critical('Unable to find revision %s', wantver)
+ if wantver is None:
+ logger.critical('No patches found.')
+ else:
+ logger.critical('Unable to find revision %s', wantver)
return
if len(lmbx.series) > 1 and not wantver:
logger.info('Will use the latest revision: v%s', lser.revision)
--
2.39.1
next prev parent reply other threads:[~2023-04-15 19:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-15 19:30 [PATCH b4 0/2] am, shazam: allow cherry-picking an out-of-series patch Philippe Blain
2023-04-15 19:30 ` Philippe Blain [this message]
2023-04-15 19:31 ` [PATCH b4 2/2] " Philippe Blain
2023-05-06 20:23 ` [PATCH b4 0/2] " Philippe Blain
2023-05-26 18:28 ` 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=20230415-am-cherry-pick-suggestion-v1-1-8951a2274256@gmail.com \
--to=levraiphilippeblain@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.