aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2023-05-26 14:27:40 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2023-05-26 14:27:40 -0400
commit02a793a55f03ef821e20518824e5627157009820 (patch)
treec1026ed8fa0a87390882558d7655a864960674e6
parent91592bf5d05f312225bf4f49d8bcc9508041bee2 (diff)
parent5872a3cfbb27a8511ee8a07f2b1a5bc79163dcd6 (diff)
downloadb4-02a793a55f03ef821e20518824e5627157009820.tar.gz
Merge patch series "am, shazam: allow cherry-picking an out-of-series patch"
Philippe Blain <levraiphilippeblain@gmail.com> says: This series makes am and shazam able to cherry-pick a patch sent by a reviewer as a suggestion (second patch). The first patch is a preparatory simplification. Link: https://msgid.link/20230415-am-cherry-pick-suggestion-v1-0-8951a2274256@gmail.com Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/mbox.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/b4/mbox.py b/b4/mbox.py
index a983092..c8e722d 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 lser is None and cmdargs.cherrypick != '_':
+ 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)
@@ -70,6 +70,13 @@ def make_am(msgs: List[email.message.Message], cmdargs: argparse.Namespace, msgi
if cmdargs.cherrypick:
cherrypick = list()
if cmdargs.cherrypick == '_':
+ # We might want to pick a patch sent as a followup, so create a fake series
+ # and add followups with diffs
+ if lser is None:
+ lser = b4.LoreSeries(revision=1, expected=1)
+ for followup in lmbx.followups:
+ if followup.has_diff:
+ lser.add_patch(followup)
# Only grab the exact msgid provided
at = 0
for lmsg in lser.patches[1:]: