+ __import_file(patch, patchfile, options)
+
+ if filename:
+ f.close()
+
+def __import_mbox(filename, options):
+ """Import a series from an mbox file
+ """
+ if filename:
+ f = file(filename, 'rb')
+ else:
+ f = sys.stdin
+
+ try:
+ mbox = UnixMailbox(f, email.message_from_file)
+ except Exception, ex:
+ raise CmdException, 'error parsing the mbox file: %s' % str(ex)
+
+ for msg in mbox:
+ message, author_name, author_email, author_date, diff = \
+ __parse_mail(msg)
+ __create_patch(None, message, author_name, author_email,
+ author_date, diff, options)
+
+ if filename:
+ f.close()