diff 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
line wrap: on
line diff
--- a/mercurial/patch.py	Thu Oct 08 23:32:36 2009 +0200
+++ b/mercurial/patch.py	Thu Oct 08 23:42:33 2009 +0200
@@ -63,6 +63,10 @@
 
         subject = msg['Subject']
         user = msg['From']
+        if not subject and not user:
+            # Not an email, restore parsed headers if any
+            subject = '\n'.join(': '.join(h) for h in msg.items()) + '\n'
+
         gitsendmail = 'git-send-email' in msg.get('X-Mailer', '')
         # should try to parse msg['Date']
         date = None