mercurial/patch.py
changeset 28341 8286f551b7ee
parent 27902 51b6ce257e0a
child 28861 86db5cb55d46
--- a/mercurial/patch.py	Wed Mar 02 22:39:03 2016 +0000
+++ b/mercurial/patch.py	Thu Mar 03 18:34:19 2016 +0100
@@ -31,6 +31,7 @@
     diffhelpers,
     encoding,
     error,
+    mail,
     mdiff,
     pathutil,
     scmutil,
@@ -210,8 +211,8 @@
     try:
         msg = email.Parser.Parser().parse(fileobj)
 
-        subject = msg['Subject']
-        data['user'] = msg['From']
+        subject = msg['Subject'] and mail.headdecode(msg['Subject'])
+        data['user'] = msg['From'] and mail.headdecode(msg['From'])
         if not subject and not data['user']:
             # Not an email, restore parsed headers if any
             subject = '\n'.join(': '.join(h) for h in msg.items()) + '\n'