From bb3e0204972e720185e4693c5779eef5f6b49907 Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Fri, 2 Oct 2020 08:56:39 -0400 Subject: Fix some cherry-picking corner cases Handle several corner cases when trying to cherrypick from incomplete series. Reported-by: Krzysztof Kozlowski Signed-off-by: Konstantin Ryabitsev --- b4/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'b4/__init__.py') diff --git a/b4/__init__.py b/b4/__init__.py index 6ffbb5c..f715713 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -499,10 +499,14 @@ class LoreSeries: at = 1 atterrors = list() for lmsg in self.patches[1:]: - if cherrypick is not None and at not in cherrypick: - at += 1 - logger.debug(' skipped: [%s/%s] (not in cherrypick)', at, self.expected) - continue + if cherrypick is not None: + if at not in cherrypick: + at += 1 + logger.debug(' skipped: [%s/%s] (not in cherrypick)', at, self.expected) + continue + if lmsg is None: + logger.critical('CRITICAL: [%s/%s] is missing, cannot cherrypick', at, self.expected) + raise KeyError('Cherrypick not in series') if lmsg is not None: if self.has_cover and covertrailers and self.patches[0].followup_trailers: lmsg.followup_trailers.update(self.patches[0].followup_trailers) -- cgit v1.2.3