aux/convert-mbox-date.py
author Dmitriy Morozov <dmitriy@mrzv.org>
Mon, 15 Nov 2010 10:46:46 -0800
changeset 54 0b2722bb35c9
parent 23 a42b9c661bc1
permissions -rw-r--r--
Fixed cf0 (exception on empty Maildir in ilist)

#!/usr/bin/env python

from mercurial.util import parsedate, datestr
import glob, mailbox

issues = glob.glob('.issues/*')

for i in issues:
	mbox=mailbox.mbox(i)
	for k in xrange(len(mbox)):
		msg = mbox[k]
		print msg['Date']
		d = parsedate(msg['Date'], ['%a, %d %b %Y %H:%M:%S %Z', '%a, %d %b %Y %H:%M:%S'])
		print d
		print datestr(d, '%a, %d %b %Y %H:%M:%S')
		msg.replace_header('Date', datestr(d, '%a, %d %b %Y %H:%M:%S'))
		mbox[k] = msg
	mbox.flush()