[PATCH 4 of 7] py3: use system string to access email headers

Yuya Nishihara yuya at tcha.org
Sun Apr 8 05:09:47 EDT 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1523167380 -32400
#      Sun Apr 08 15:03:00 2018 +0900
# Node ID 323e34785dacaad98d06dd3b15c2370779149e97
# Parent  9e3b46147b952770b7b10d626a745df8f3c1eeb1
py3: use system string to access email headers

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -224,8 +224,8 @@ def extract(ui, fileobj):
     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))


More information about the Mercurial-devel mailing list