# HG changeset patch # User Yuya Nishihara # Date 2018-04-07 04:42:37 # Node ID 19becdf565eff754030712800511e6fe085763b5 # Parent 9ecb7c471cfb8e4c4b19cb1d7f7df9b49a3080c5 py3: convert parsed message items to bytes in patch.extract() Appears that BytesParser() parses bytes into unicode, sigh. diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -228,7 +228,8 @@ def extract(ui, fileobj): 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 = []