Mercurial > hg-stable
changeset 39059:b95538a21613
patchbomb: work around email module really wanting to write unicode data
Differential Revision: https://phab.mercurial-scm.org/D3951
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 16 Jul 2018 14:14:27 -0400 |
parents | 0b5f534df82a |
children | 858fe9625dab |
files | hgext/patchbomb.py |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/patchbomb.py Thu Aug 09 12:25:06 2018 -0700 +++ b/hgext/patchbomb.py Mon Jul 16 14:14:27 2018 -0400 @@ -139,6 +139,11 @@ default=None, ) +if pycompat.ispy3: + _bytesgenerator = emailgen.BytesGenerator +else: + _bytesgenerator = lambda f: f + # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should # be specifying the version(s) of Mercurial they are tested with, or @@ -793,7 +798,8 @@ if opts.get('test'): ui.status(_('displaying '), subj, ' ...\n') ui.pager('email') - generator = emailgen.Generator(ui, mangle_from_=False) + generator = emailgen.Generator(_bytesgenerator(ui), + mangle_from_=False) try: generator.flatten(m, 0) ui.write('\n') @@ -809,7 +815,8 @@ # Exim does not remove the Bcc field del m['Bcc'] fp = stringio() - generator = emailgen.Generator(fp, mangle_from_=False) + generator = emailgen.Generator(_bytesgenerator(fp), + mangle_from_=False) generator.flatten(m, 0) sendmail(sender_addr, to + bcc + cc, fp.getvalue())