aux/convert-mbox-date.py
author "Tomas Zeman <tzeman@volny.cz>"
Thu, 10 Jun 2010 08:34:23 +0200
changeset 66 bf3b55a54cff
parent 23 a42b9c661bc1
permissions -rw-r--r--
Added #a5d5a0: Attachments should be stored without path

#!/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()