Show More
@@ -66,7 +66,8 b'' | |||||
66 |
|
66 | |||
67 | import os, errno, socket, tempfile |
|
67 | import os, errno, socket, tempfile | |
68 | import email.MIMEMultipart, email.MIMEText, email.MIMEBase |
|
68 | import email.MIMEMultipart, email.MIMEText, email.MIMEBase | |
69 | import email.Utils, email.Encoders |
|
69 | import email.Utils, email.Encoders, email.Generator | |
|
70 | import cStringIO.StringIO | |||
70 | from mercurial import cmdutil, commands, hg, mail, patch, util |
|
71 | from mercurial import cmdutil, commands, hg, mail, patch, util | |
71 | from mercurial.i18n import _ |
|
72 | from mercurial.i18n import _ | |
72 | from mercurial.node import bin |
|
73 | from mercurial.node import bin | |
@@ -407,8 +408,9 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
407 | fp = os.popen(os.environ['PAGER'], 'w') |
|
408 | fp = os.popen(os.environ['PAGER'], 'w') | |
408 | else: |
|
409 | else: | |
409 | fp = ui |
|
410 | fp = ui | |
|
411 | generator = email.Generator.Generator(fp, mangle_from_=False) | |||
410 | try: |
|
412 | try: | |
411 | fp.write(m.as_string(0)) |
|
413 | generator.flatten(m, 0) | |
412 | fp.write('\n') |
|
414 | fp.write('\n') | |
413 | except IOError, inst: |
|
415 | except IOError, inst: | |
414 | if inst.errno != errno.EPIPE: |
|
416 | if inst.errno != errno.EPIPE: | |
@@ -418,9 +420,10 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
418 | elif opts.get('mbox'): |
|
420 | elif opts.get('mbox'): | |
419 | ui.status('Writing ', m['Subject'], ' ...\n') |
|
421 | ui.status('Writing ', m['Subject'], ' ...\n') | |
420 | fp = open(opts.get('mbox'), 'In-Reply-To' in m and 'ab+' or 'wb+') |
|
422 | fp = open(opts.get('mbox'), 'In-Reply-To' in m and 'ab+' or 'wb+') | |
|
423 | generator = email.Generator.Generator(fp, mangle_from_=True) | |||
421 | date = util.datestr(start_time, '%a %b %d %H:%M:%S %Y') |
|
424 | date = util.datestr(start_time, '%a %b %d %H:%M:%S %Y') | |
422 | fp.write('From %s %s\n' % (sender_addr, date)) |
|
425 | fp.write('From %s %s\n' % (sender_addr, date)) | |
423 | fp.write(m.as_string(0)) |
|
426 | generator.flatten(m, 0) | |
424 | fp.write('\n\n') |
|
427 | fp.write('\n\n') | |
425 | fp.close() |
|
428 | fp.close() | |
426 | else: |
|
429 | else: | |
@@ -429,7 +432,10 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
429 | ui.status('Sending ', m['Subject'], ' ...\n') |
|
432 | ui.status('Sending ', m['Subject'], ' ...\n') | |
430 | # Exim does not remove the Bcc field |
|
433 | # Exim does not remove the Bcc field | |
431 | del m['Bcc'] |
|
434 | del m['Bcc'] | |
432 | sendmail(sender, to + bcc + cc, m.as_string(0)) |
|
435 | fp = cStringIO.StringIO() | |
|
436 | generator = email.Generator.Generator(fp, mangle_from_=False) | |||
|
437 | generator.flatten(m, 0) | |||
|
438 | sendmail(sender, to + bcc + cc, fp.getvalue()) | |||
433 |
|
439 | |||
434 | cmdtable = { |
|
440 | cmdtable = { | |
435 | "email": |
|
441 | "email": |
General Comments 0
You need to be logged in to leave comments.
Login now