mercurial/patch.py
changeset 36045 04984f2e50ae
parent 36035 95791b275b73
child 36046 a5cf79755eff
--- a/mercurial/patch.py	Sun Feb 11 13:32:18 2018 -0800
+++ b/mercurial/patch.py	Sun Feb 11 14:17:23 2018 -0800
@@ -12,7 +12,6 @@
 import copy
 import difflib
 import email
-import email.parser as emailparser
 import errno
 import hashlib
 import os
@@ -109,7 +108,7 @@
             cur.append(line)
         c = chunk(cur)
 
-        m = emailparser.Parser().parse(c)
+        m = pycompat.emailparser().parse(c)
         if not m.is_multipart():
             yield msgfp(m)
         else:
@@ -218,7 +217,7 @@
     fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
     tmpfp = os.fdopen(fd, pycompat.sysstr('w'))
     try:
-        msg = emailparser.Parser().parse(fileobj)
+        msg = pycompat.emailparser().parse(fileobj)
 
         subject = msg['Subject'] and mail.headdecode(msg['Subject'])
         data['user'] = msg['From'] and mail.headdecode(msg['From'])