mercurial/patch.py
changeset 37468 ef661ce45cdb
parent 37463 bbd240f81ac5
child 37471 51d5e1ff0613
equal deleted inserted replaced
37467:9bf65d1b43a6 37468:ef661ce45cdb
   222     fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
   222     fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
   223     tmpfp = os.fdopen(fd, r'wb')
   223     tmpfp = os.fdopen(fd, r'wb')
   224     try:
   224     try:
   225         msg = pycompat.emailparser().parse(fileobj)
   225         msg = pycompat.emailparser().parse(fileobj)
   226 
   226 
   227         subject = msg['Subject'] and mail.headdecode(msg['Subject'])
   227         subject = msg[r'Subject'] and mail.headdecode(msg[r'Subject'])
   228         data['user'] = msg['From'] and mail.headdecode(msg['From'])
   228         data['user'] = msg[r'From'] and mail.headdecode(msg[r'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(map(encoding.strtolocal, h))
   231             subject = '\n'.join(': '.join(map(encoding.strtolocal, h))
   232                                 for h in msg.items()) + '\n'
   232                                 for h in msg.items()) + '\n'
   233 
   233