changeset 4220:1253703853a8

git-send-email compatibility: stop reading changelog after ^---$
author Brendan Cully <brendan@kublai.com>
date Wed, 14 Mar 2007 11:46:07 -0700
parents 6cb5be6bd70f
children 0a95d0e83b4c
files mercurial/patch.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Wed Mar 14 10:45:18 2007 -0700
+++ b/mercurial/patch.py	Wed Mar 14 11:46:07 2007 -0700
@@ -48,8 +48,6 @@
     fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
     tmpfp = os.fdopen(fd, 'w')
     try:
-        hgpatch = False
-
         msg = email.Parser.Parser().parse(fileobj)
 
         message = msg['Subject']
@@ -77,6 +75,9 @@
             payload = part.get_payload(decode=True)
             m = diffre.search(payload)
             if m:
+                hgpatch = False
+                ignoretext = False
+
                 ui.debug(_('found patch at byte %d\n') % m.start(0))
                 diffs_seen += 1
                 cfp = cStringIO.StringIO()
@@ -96,7 +97,9 @@
                             ui.debug('From: %s\n' % user)
                         elif line.startswith("# Date "):
                             date = line[7:]
-                    if not line.startswith('# '):
+                    elif line == '---' and 'git-send-email' in msg['X-Mailer']:
+                        ignoretext = True
+                    if not line.startswith('# ') and not ignoretext:
                         cfp.write(line)
                         cfp.write('\n')
                 message = cfp.getvalue()