changeset 9046:1547126630e9

patchbomb: fix From_ in the message's envelope Localized date in the From_ prevents MUAs like mutt from parsing mbox files generated by patchbomb. Using a 24 characters date in asctime format instead.
author Cédric Duval <cedricduval@free.fr>
date Sun, 05 Jul 2009 16:42:10 +0200
parents 500013d3b6a9
children 8263d98ffb1c
files hgext/patchbomb.py tests/test-patchbomb.out
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/patchbomb.py	Tue Jul 07 14:20:58 2009 +0200
+++ b/hgext/patchbomb.py	Sun Jul 05 16:42:10 2009 +0200
@@ -70,7 +70,7 @@
 directly from the commandline. See the [email] and [smtp] sections in
 hgrc(5) for details.'''
 
-import os, errno, socket, tempfile, cStringIO
+import os, errno, socket, tempfile, cStringIO, time
 import email.MIMEMultipart, email.MIMEBase
 import email.Utils, email.Encoders, email.Generator
 from mercurial import cmdutil, commands, hg, mail, patch, util
@@ -446,7 +446,7 @@
             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 = util.datestr(start_time, '%a %b %d %H:%M:%S %Y')
+            date = time.ctime(start_time[0])
             fp.write('From %s %s\n' % (sender_addr, date))
             generator.flatten(m, 0)
             fp.write('\n\n')
--- a/tests/test-patchbomb.out	Tue Jul 07 14:20:58 2009 +0200
+++ b/tests/test-patchbomb.out	Sun Jul 05 16:42:10 2009 +0200
@@ -163,7 +163,7 @@
 
 
 Writing [PATCH] charset=utf-8; content-transfer-encoding: base64 ...
-From quux Thu Jan 01 00:04:01 1970
+From quux Thu Jan  1 00:04:01 1970
 Content-Type: text/plain; charset="utf-8"
 MIME-Version: 1.0
 Content-Transfer-Encoding: base64
@@ -198,7 +198,7 @@
 
 
 Writing [PATCH] charset=utf-8; content-transfer-encoding: quoted-printable ...
-From quux Thu Jan 01 00:04:01 1970
+From quux Thu Jan  1 00:04:01 1970
 Content-Type: text/plain; charset="us-ascii"
 MIME-Version: 1.0
 Content-Transfer-Encoding: quoted-printable
@@ -249,7 +249,7 @@
 
 Writing [PATCH] charset=us-ascii; content-transfer-encoding: 8bit ...
 % md5sum of 8-bit output
-e61684fc0bcccba4204714be37951893  mboxfix
+8ce4c019c17ca51a293c055382d76d67  mboxfix
 % test diffstat for single patch
 This patch series consists of 1 patches.