comparison mercurial/patch.py @ 9573:b8352a3617f3

patch: do not swallow header-like patch first line (issue1859) Current solution is hackish but looks like a good trade-off short of rewriting patch.extract() significantly.
author Patrick Mezard <pmezard@gmail.com>
date Thu, 08 Oct 2009 23:42:33 +0200
parents df21a009c9c4
children c156bf947e26 ea1935e2020a
comparison
equal deleted inserted replaced
9572:1f665246dab3 9573:b8352a3617f3
61 try: 61 try:
62 msg = email.Parser.Parser().parse(fileobj) 62 msg = email.Parser.Parser().parse(fileobj)
63 63
64 subject = msg['Subject'] 64 subject = msg['Subject']
65 user = msg['From'] 65 user = msg['From']
66 if not subject and not user:
67 # Not an email, restore parsed headers if any
68 subject = '\n'.join(': '.join(h) for h in msg.items()) + '\n'
69
66 gitsendmail = 'git-send-email' in msg.get('X-Mailer', '') 70 gitsendmail = 'git-send-email' in msg.get('X-Mailer', '')
67 # should try to parse msg['Date'] 71 # should try to parse msg['Date']
68 date = None 72 date = None
69 nodeid = None 73 nodeid = None
70 branch = None 74 branch = None