diff options
author | Philippe Blain <levraiphilippeblain@gmail.com> | 2023-04-15 15:30:59 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2023-05-26 14:26:37 -0400 |
commit | 6c9ad4ec28f9a14cd8d20c933eef7bce0285a60a (patch) | |
tree | 3336b2ded446ea260222b7f12c2d6d1ee95732c2 | |
parent | 00303592f25693cb4eddf58fb51063afcff8dceb (diff) | |
download | b4-6c9ad4ec28f9a14cd8d20c933eef7bce0285a60a.tar.gz |
mbox.py::make_am: simplify check for early return
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>
Link: https://msgid.link/20230415-am-cherry-pick-suggestion-v1-1-8951a2274256@gmail.com
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/mbox.py | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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) |