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:02:13 -0400
commit8959031380f0f74177a1b5d2da360bf23d23088f (patch)
tree93854b54b44a39fb6a37f902ef1df05aa3adb4b2
parentbaa5b9fb51a094ddfee294f3610d1cbdb2943cac (diff)
downloadb4-8959031380f0f74177a1b5d2da360bf23d23088f.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)