diff -r 9bf65d1b43a6 -r ef661ce45cdb mercurial/patch.py --- a/mercurial/patch.py Sun Apr 08 14:59:12 2018 +0900 +++ b/mercurial/patch.py Sun Apr 08 15:03:00 2018 +0900 @@ -224,8 +224,8 @@ try: msg = pycompat.emailparser().parse(fileobj) - subject = msg['Subject'] and mail.headdecode(msg['Subject']) - data['user'] = msg['From'] and mail.headdecode(msg['From']) + subject = msg[r'Subject'] and mail.headdecode(msg[r'Subject']) + data['user'] = msg[r'From'] and mail.headdecode(msg[r'From']) if not subject and not data['user']: # Not an email, restore parsed headers if any subject = '\n'.join(': '.join(map(encoding.strtolocal, h))