diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2023-05-26 14:27:40 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2023-05-26 14:27:40 -0400 |
commit | 02a793a55f03ef821e20518824e5627157009820 (patch) | |
tree | c1026ed8fa0a87390882558d7655a864960674e6 | |
parent | 91592bf5d05f312225bf4f49d8bcc9508041bee2 (diff) | |
parent | 5872a3cfbb27a8511ee8a07f2b1a5bc79163dcd6 (diff) | |
download | b4-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.py | 17 |
1 files changed, 12 insertions, 5 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 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:]: |