Mercurial > public > mercurial-scm > hg-stable
diff hgext/patchbomb.py @ 9818:72d670c43f6e
patchbomb: normalize date format in generated mboxes
mbox format should use time.asctime(). Unfortunately, this function writes
2-characters day of week on Windows while unix one writes a single character.
Normalize to Windows version since the other one can hardly be written with
strftime().
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 08 Nov 2009 18:08:24 +0100 |
parents | 6064de41b7e4 |
children | 4600e6222efb 4ddfad7ebd98 |
line wrap: on
line diff
--- a/hgext/patchbomb.py Tue Nov 10 11:57:03 2009 +0100 +++ b/hgext/patchbomb.py Sun Nov 08 18:08:24 2009 +0100 @@ -451,7 +451,10 @@ ui.status(_('Writing '), subj, ' ...\n') fp = open(opts.get('mbox'), 'In-Reply-To' in m and 'ab+' or 'wb+') generator = email.Generator.Generator(fp, mangle_from_=True) - date = time.ctime(start_time[0]) + # Should be time.asctime(), but Windows prints 2-characters day + # of month instead of one. Make them print the same thing. + date = time.strftime('%a %b %d %H:%M:%S %Y', + time.localtime(start_time[0])) fp.write('From %s %s\n' % (sender_addr, date)) generator.flatten(m, 0) fp.write('\n\n')