Mercurial > public > mercurial-scm > hg-stable
diff mercurial/patch.py @ 28341:8286f551b7ee
patch: when importing from email, RFC2047-decode From/Subject headers
Reported at https://bugs.debian.org/737498
author | Julien Cristau <julien.cristau@logilab.fr> |
---|---|
date | Thu, 03 Mar 2016 18:34:19 +0100 |
parents | 51b6ce257e0a |
children | 86db5cb55d46 |
line wrap: on
line diff
--- 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'