From: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
To: signatures@kernel.org
Subject: [PATCH 10/10] Fix some cherry-picking corner cases
Date: Fri, 2 Oct 2020 19:29:15 -0400 [thread overview]
Message-ID: <20201002232915.1728301-11-konstantin@linuxfoundation.org> (raw)
In-Reply-To: <20201002232915.1728301-1-konstantin@linuxfoundation.org>
Handle several corner cases when trying to cherrypick from incomplete
series.
Reported-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
---
b4/__init__.py | 12 ++++++++----
b4/mbox.py | 20 ++++++++++++--------
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/b4/__init__.py b/b4/__init__.py
index f0d5d24..dc393a9 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -504,10 +504,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 += self.patches[0].followup_trailers
diff --git a/b4/mbox.py b/b4/mbox.py
index 754d0f8..2ec74c9 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -86,12 +86,12 @@ def mbox_to_am(mboxfile, cmdargs):
at = 0
for lmsg in lser.patches[1:]:
at += 1
- if lmsg.msgid == msgid:
+ if lmsg and lmsg.msgid == msgid:
cherrypick = [at]
- cmdargs.cherrypick = '5'
+ cmdargs.cherrypick = f'<{msgid}>'
break
if not len(cherrypick):
- logger.critical('Specified msgid is not present in the series, cannot cherry-pick')
+ logger.critical('Specified msgid is not present in the series, cannot cherrypick')
sys.exit(1)
elif cmdargs.cherrypick.find('*') >= 0:
# Globbing on subject
@@ -110,10 +110,14 @@ def mbox_to_am(mboxfile, cmdargs):
logger.critical('Writing %s', am_filename)
mbx = mailbox.mbox(am_filename)
- am_mbx = lser.save_am_mbox(mbx, noaddtrailers=cmdargs.noaddtrailers,
- covertrailers=covertrailers, trailer_order=config['trailer-order'],
- addmysob=cmdargs.addmysob, addlink=cmdargs.addlink,
- linkmask=config['linkmask'], cherrypick=cherrypick)
+ try:
+ am_mbx = lser.save_am_mbox(mbx, noaddtrailers=cmdargs.noaddtrailers,
+ covertrailers=covertrailers, trailer_order=config['trailer-order'],
+ addmysob=cmdargs.addmysob, addlink=cmdargs.addlink,
+ linkmask=config['linkmask'], cherrypick=cherrypick)
+ except KeyError:
+ sys.exit(1)
+
logger.info('---')
if cherrypick is None:
@@ -153,7 +157,7 @@ def mbox_to_am(mboxfile, cmdargs):
logger.info('Prepared a fake commit range for 3-way merge (%.12s..%.12s)', rstart, rend)
logger.critical('---')
- if not lser.complete:
+ if not lser.complete and not cmdargs.cherrypick:
logger.critical('WARNING: Thread incomplete!')
if lser.has_cover and not cmdargs.nocover:
--
2.26.2
prev parent reply other threads:[~2020-10-02 23:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-02 23:29 [PATCH 00/10] Entirely fake patch set Konstantin Ryabitsev
2020-10-02 23:29 ` [PATCH 01/10] Use shorter cache file names Konstantin Ryabitsev
2020-10-02 23:29 ` [PATCH 02/10] Preserve trailer order by default Konstantin Ryabitsev
2020-10-02 23:29 ` [PATCH 03/10] Don't force trailers into a set Konstantin Ryabitsev
2020-10-02 23:29 ` [PATCH 04/10] Initial go at supporting [extra trailer data] Konstantin Ryabitsev
2020-10-02 23:29 ` [PATCH 05/10] Tighten follow-up header parsing Konstantin Ryabitsev
2020-10-02 23:29 ` [PATCH 06/10] Use a more precise regex for email trailers Konstantin Ryabitsev
2020-10-02 23:29 ` [PATCH 07/10] Set charset in order to generate MIME headers Konstantin Ryabitsev
2020-10-02 23:29 ` [PATCH 08/10] Use bytes when dumping to stdout Konstantin Ryabitsev
2020-10-02 23:29 ` [PATCH 09/10] Don't crash when no valid patches are found Konstantin Ryabitsev
2020-10-02 23:29 ` Konstantin Ryabitsev [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201002232915.1728301-11-konstantin@linuxfoundation.org \
--to=konstantin@linuxfoundation.org \
--cc=signatures@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).