Show More
@@ -65,8 +65,8 b'' | |||||
65 |
|
65 | |||
66 | from mercurial.demandload import * |
|
66 | from mercurial.demandload import * | |
67 | demandload(globals(), '''email.MIMEMultipart email.MIMEText email.Utils |
|
67 | demandload(globals(), '''email.MIMEMultipart email.MIMEText email.Utils | |
68 | mercurial:cmdutil,commands,hg,mail,ui,patch |
|
68 | mercurial:cmdutil,commands,hg,mail,ui,patch,util | |
69 |
os errno popen2 socket sys tempfile |
|
69 | os errno popen2 socket sys tempfile''') | |
70 | from mercurial.i18n import gettext as _ |
|
70 | from mercurial.i18n import gettext as _ | |
71 | from mercurial.node import * |
|
71 | from mercurial.node import * | |
72 |
|
72 | |||
@@ -165,10 +165,10 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
165 | msg['X-Mercurial-Node'] = node |
|
165 | msg['X-Mercurial-Node'] = node | |
166 | return msg |
|
166 | return msg | |
167 |
|
167 | |||
168 |
start_time = |
|
168 | start_time = util.makedate() | |
169 |
|
169 | |||
170 | def genmsgid(id): |
|
170 | def genmsgid(id): | |
171 | return '<%s.%s@%s>' % (id[:20], start_time, socket.getfqdn()) |
|
171 | return '<%s.%s@%s>' % (id[:20], int(start_time[0]), socket.getfqdn()) | |
172 |
|
172 | |||
173 | patches = [] |
|
173 | patches = [] | |
174 |
|
174 | |||
@@ -254,13 +254,6 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
254 | mailer = mail.connect(ui) |
|
254 | mailer = mail.connect(ui) | |
255 | parent = None |
|
255 | parent = None | |
256 |
|
256 | |||
257 | # Calculate UTC offset |
|
|||
258 | if time.daylight: offset = time.altzone |
|
|||
259 | else: offset = time.timezone |
|
|||
260 | if offset <= 0: sign, offset = '+', -offset |
|
|||
261 | else: sign = '-' |
|
|||
262 | offset = '%s%02d%02d' % (sign, offset / 3600, (offset % 3600) / 60) |
|
|||
263 |
|
||||
264 | sender_addr = email.Utils.parseaddr(sender)[1] |
|
257 | sender_addr = email.Utils.parseaddr(sender)[1] | |
265 | for m in msgs: |
|
258 | for m in msgs: | |
266 | try: |
|
259 | try: | |
@@ -271,9 +264,10 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
271 | m['In-Reply-To'] = parent |
|
264 | m['In-Reply-To'] = parent | |
272 | else: |
|
265 | else: | |
273 | parent = m['Message-Id'] |
|
266 | parent = m['Message-Id'] | |
274 | m['Date'] = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime(start_time)) + ' ' + offset |
|
267 | m['Date'] = util.datestr(date=start_time, | |
|
268 | format="%a, %d %b %Y %H:%M:%S", timezone=True) | |||
275 |
|
269 | |||
276 | start_time += 1 |
|
270 | start_time = (start_time[0] + 1, start_time[1]) | |
277 | m['From'] = sender |
|
271 | m['From'] = sender | |
278 | m['To'] = ', '.join(to) |
|
272 | m['To'] = ', '.join(to) | |
279 | if cc: m['Cc'] = ', '.join(cc) |
|
273 | if cc: m['Cc'] = ', '.join(cc) | |
@@ -291,7 +285,8 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
291 | elif opts['mbox']: |
|
285 | elif opts['mbox']: | |
292 | ui.status('Writing ', m['Subject'], ' ...\n') |
|
286 | ui.status('Writing ', m['Subject'], ' ...\n') | |
293 | fp = open(opts['mbox'], m.has_key('In-Reply-To') and 'ab+' or 'wb+') |
|
287 | fp = open(opts['mbox'], m.has_key('In-Reply-To') and 'ab+' or 'wb+') | |
294 |
date = |
|
288 | date = util.datestr(date=start_time, | |
|
289 | format='%a %b %d %H:%M:%S %Y', timezone=False) | |||
295 | fp.write('From %s %s\n' % (sender_addr, date)) |
|
290 | fp.write('From %s %s\n' % (sender_addr, date)) | |
296 | fp.write(m.as_string(0)) |
|
291 | fp.write(m.as_string(0)) | |
297 | fp.write('\n\n') |
|
292 | fp.write('\n\n') |
General Comments 0
You need to be logged in to leave comments.
Login now