changeset 37456:19becdf565ef

py3: convert parsed message items to bytes in patch.extract() Appears that BytesParser() parses bytes into unicode, sigh.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 07 Apr 2018 13:42:37 +0900
parents 9ecb7c471cfb
children d83191e9749b
files mercurial/patch.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Sat Apr 07 13:21:59 2018 +0900
+++ b/mercurial/patch.py	Sat Apr 07 13:42:37 2018 +0900
@@ -228,7 +228,8 @@
         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'
+            subject = '\n'.join(': '.join(map(encoding.strtolocal, h))
+                                for h in msg.items()) + '\n'
 
         # should try to parse msg['Date']
         parents = []