aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-05-20 15:58:27 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-05-20 15:58:27 -0400
commit8ca2d7f96a4179015b4f4c30d7b906c1b23abf24 (patch)
tree8887a425c95274d3b75f783b30f77dff5ff1443a
parent5e1f198ef2275ca0bd2db0f264ed75ae8561b73d (diff)
downloadb4-8ca2d7f96a4179015b4f4c30d7b906c1b23abf24.tar.gz
Cherrypick from the correct series revision
When cherrypicking by msgid and with multiple revisions available, make sure that we pick the series revision that actually contains the msgid being cherrypicked. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/mbox.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/b4/mbox.py b/b4/mbox.py
index 74e0f8e..4364ebd 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -47,6 +47,17 @@ def make_am(msgs, cmdargs, msgid):
reroll = True
if cmdargs.nopartialreroll:
reroll = False
+ if cmdargs.cherrypick == '_' and not wantver and len(lmbx.series) > 1:
+ # Make sure we pick the revision containing the msgid
+ wantver = None
+ for cnum, clser in lmbx.series.items():
+ for lmsg in clser.patches:
+ if lmsg and lmsg.msgid == msgid:
+ wantver = cnum
+ break
+ if wantver:
+ break
+
lser = lmbx.get_series(revision=wantver, sloppytrailers=cmdargs.sloppytrailers, reroll=reroll)
if lser is None and wantver is None:
logger.critical('No patches found.')