diff mercurial/patch.py @ 43156:0e6a7ce81dde

py3: use email.generator.BytesGenerator in patch.split() This fixes test-import.t on python3. We add Generator alias in mail module to handle python2/python3 compatibility.
author Denis Laxalde <denis.laxalde@logilab.fr>
date Thu, 10 Oct 2019 10:48:57 +0200
parents a83c9c79b722
children a5b04863dbff
line wrap: on
line diff
--- a/mercurial/patch.py	Thu Oct 10 10:03:01 2019 +0200
+++ b/mercurial/patch.py	Thu Oct 10 10:48:57 2019 +0200
@@ -11,7 +11,6 @@
 import collections
 import contextlib
 import copy
-import email
 import errno
 import hashlib
 import os
@@ -107,7 +106,7 @@
     def mimesplit(stream, cur):
         def msgfp(m):
             fp = stringio()
-            g = email.Generator.Generator(fp, mangle_from_=False)
+            g = mail.Generator(fp, mangle_from_=False)
             g.flatten(m)
             fp.seek(0)
             return fp