diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-07-27 10:02:13 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-07-27 10:02:13 -0400 |
commit | 8959031380f0f74177a1b5d2da360bf23d23088f (patch) | |
tree | 93854b54b44a39fb6a37f902ef1df05aa3adb4b2 | |
parent | baa5b9fb51a094ddfee294f3610d1cbdb2943cac (diff) | |
download | b4-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.py | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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) |