patchbomb and localized date headers

Martijn Pieters mj at zopatista.com
Wed May 6 02:54:40 CDT 2009


2009/5/6 Mark Hammond <skippy.hammond at gmail.com>:
> Date: Seg, 20 Abr 2009 21:28:48 -0300
...
> Note the date field.  Python's email parser blows up with this date:
....
> My apologies for not digging in any more, or if this is fixed in a later
> version.  Please let me know if you'd like me to paste this info into a
> new bug...

It still applies; from mercurial-crew/hgext/patchbomb.py:402:

        m['Date'] = util.datestr(start_time, "%a, %d %b %Y %H:%M:%S %1%2")

util.datestr will replace %1%2 with the timezone, convert start_time
to gmtime, then use time.strftime to format the date string. Note the
%a and %b in there, those are localized strings.

This line should use an RFC 8222 compliant format string instead,
which means we'll have to either use the formatdate method in the
standard library module email.utils, or add support for English-only
month and weekday abbreviations to mercurial.util.datestr the same way
that email.utils.formatdate does this. We can't do this in
patchbomb.py as the timezone juggling can influence what day and month
are to be interpolated.

-- 
Martijn Pieters



More information about the Mercurial-devel mailing list