##// END OF EJS Templates
py3: use email.generator.BytesGenerator in patch.split()...
Denis Laxalde -
r43426:0e6a7ce8 default
parent child Browse files
Show More
@@ -9,6 +9,7 b' from __future__ import absolute_import'
9
9
10 import email
10 import email
11 import email.charset
11 import email.charset
12 import email.generator
12 import email.header
13 import email.header
13 import email.message
14 import email.message
14 import email.parser
15 import email.parser
@@ -420,6 +421,8 b' def mimeencode(ui, s, charsets=None, dis'
420
421
421 if pycompat.ispy3:
422 if pycompat.ispy3:
422
423
424 Generator = email.generator.BytesGenerator
425
423 def parse(fp):
426 def parse(fp):
424 ep = email.parser.Parser()
427 ep = email.parser.Parser()
425 # disable the "universal newlines" mode, which isn't binary safe.
428 # disable the "universal newlines" mode, which isn't binary safe.
@@ -436,6 +439,8 b' if pycompat.ispy3:'
436
439
437 else:
440 else:
438
441
442 Generator = email.generator.Generator
443
439 def parse(fp):
444 def parse(fp):
440 ep = email.parser.Parser()
445 ep = email.parser.Parser()
441 return ep.parse(fp)
446 return ep.parse(fp)
@@ -11,7 +11,6 b' from __future__ import absolute_import, '
11 import collections
11 import collections
12 import contextlib
12 import contextlib
13 import copy
13 import copy
14 import email
15 import errno
14 import errno
16 import hashlib
15 import hashlib
17 import os
16 import os
@@ -107,7 +106,7 b' def split(stream):'
107 def mimesplit(stream, cur):
106 def mimesplit(stream, cur):
108 def msgfp(m):
107 def msgfp(m):
109 fp = stringio()
108 fp = stringio()
110 g = email.Generator.Generator(fp, mangle_from_=False)
109 g = mail.Generator(fp, mangle_from_=False)
111 g.flatten(m)
110 g.flatten(m)
112 fp.seek(0)
111 fp.seek(0)
113 return fp
112 return fp
General Comments 0
You need to be logged in to leave comments. Login now