comparison mercurial/patch.py @ 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 a8a902d7176e
children 00e4bd97b095
comparison
equal deleted inserted replaced
37455:9ecb7c471cfb 37456:19becdf565ef
226 226
227 subject = msg['Subject'] and mail.headdecode(msg['Subject']) 227 subject = msg['Subject'] and mail.headdecode(msg['Subject'])
228 data['user'] = msg['From'] and mail.headdecode(msg['From']) 228 data['user'] = msg['From'] and mail.headdecode(msg['From'])
229 if not subject and not data['user']: 229 if not subject and not data['user']:
230 # Not an email, restore parsed headers if any 230 # Not an email, restore parsed headers if any
231 subject = '\n'.join(': '.join(h) for h in msg.items()) + '\n' 231 subject = '\n'.join(': '.join(map(encoding.strtolocal, h))
232 for h in msg.items()) + '\n'
232 233
233 # should try to parse msg['Date'] 234 # should try to parse msg['Date']
234 parents = [] 235 parents = []
235 236
236 if subject: 237 if subject: