summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-07-27 10:02:13 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-07-27 10:06:05 -0400
commit8823118dc9c378f632bafe5ffe1c3283eddc0a91 (patch)
tree451421249a072260825e0efc6e33c5ed8730e1b5
parent2737ccdd3dbf58e330ace3ec658511bfbd715059 (diff)
downloadb4-8823118dc9c378f632bafe5ffe1c3283eddc0a91.tar.gz
Support mbox -m to be a maildir
It's a simple if/else to support maildirs for local operations, so let's handle mbox -m to be a maildir. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/mbox.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/b4/mbox.py b/b4/mbox.py
index 2391405..fb82389 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -35,7 +35,10 @@ def mbox_to_am(mboxfile, cmdargs):
wantver = cmdargs.wantver
wantname = cmdargs.wantname
covertrailers = cmdargs.covertrailers
- mbx = mailbox.mbox(mboxfile)
+ if os.path.isdir(mboxfile):
+ mbx = mailbox.Maildir(mboxfile)
+ else:
+ mbx = mailbox.mbox(mboxfile)
count = len(mbx)
logger.info('Analyzing %s messages in the thread', count)
lmbx = b4.LoreMailbox()
@@ -340,7 +343,11 @@ def am_mbox_to_quilt(am_mbx, q_dirname):
def get_extra_series(mboxfile, direction=1, wantvers=None, nocache=False):
# Open the mbox and find the latest series mentioned in it
- mbx = mailbox.mbox(mboxfile)
+ if os.path.isdir(mboxfile):
+ mbx = mailbox.Maildir(mboxfile)
+ else:
+ mbx = mailbox.mbox(mboxfile)
+
base_msg = None
latest_revision = None
seen_msgids = list()
@@ -512,6 +519,7 @@ def main(cmdargs):
if cmdargs.wantname:
savefile = os.path.join(cmdargs.outdir, cmdargs.wantname)
else:
+ msgid = b4.get_msgid(cmdargs)
savefile = os.path.join(cmdargs.outdir, '%s.mbx' % msgid)
shutil.copy(threadmbox, savefile)