From 0bff0fb4375a40755ec0ffcc3eb6c67e195baefc Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Thu, 16 Jun 2022 11:31:35 -0400 Subject: Allow breaking threads using --no-parent It is a common request to be able to get a partial thread in case someone submitted an auxiliary standalone patch in the middle of a larger patch series. Passing the msgid of the start of the thread along with --no-parent should tell b4 to break the thread at the start of the message-id specified and only consider that message and its children. Suggested-by: Mark Brown Link: https://lore.kernel.org/tools/YpTI9lhCfA7shi6j@sirena.org.uk/ Signed-off-by: Konstantin Ryabitsev --- b4/mbox.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'b4/mbox.py') diff --git a/b4/mbox.py b/b4/mbox.py index c2e6319..4ac2c29 100644 --- a/b4/mbox.py +++ b/b4/mbox.py @@ -656,12 +656,9 @@ def get_msgs(cmdargs) -> Tuple[Optional[str], Optional[list]]: sys.exit(1) pickings = set() - try: - if cmdargs.cherrypick == '_': - # Just that msgid, please - pickings = {msgid} - except AttributeError: - pass + if 'cherrypick' in cmdargs and cmdargs.cherrypick == '_': + # Just that msgid, please + pickings = {msgid} msgs = b4.get_pi_thread_by_msgid(msgid, useproject=cmdargs.useproject, nocache=cmdargs.nocache, onlymsgids=pickings) if not msgs: @@ -693,6 +690,9 @@ def get_msgs(cmdargs) -> Tuple[Optional[str], Optional[list]]: logger.critical('Mailbox %s does not exist', cmdargs.localmbox) sys.exit(1) + if msgid and 'noparent' in cmdargs and cmdargs.noparent: + msgs = b4.get_strict_thread(msgs, msgid, noparent=True) + if not msgid and msgs: for msg in msgs: msgid = msg.get('Message-ID', None) -- cgit v1.2.3