# HG changeset patch # User Cédric Duval # Date 2009-07-05 14:42:10 # Node ID 1547126630e98788bc312ddacc80c508435c7fb9 # Parent 500013d3b6a984187c140cc4ebc1cd66b4800503 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. diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -70,7 +70,7 @@ that the patchbomb extension can automat 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 @@ def patchbomb(ui, repo, *revs, **opts): 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') diff --git a/tests/test-patchbomb.out b/tests/test-patchbomb.out --- a/tests/test-patchbomb.out +++ b/tests/test-patchbomb.out @@ -163,7 +163,7 @@ This patch series consists of 1 patches. 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 @@ This patch series consists of 1 patches. 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 @@ This patch series consists of 1 patches. 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.