--- a/mercurial/patch.py Fri Oct 08 22:36:11 2010 -0500
+++ b/mercurial/patch.py Fri Oct 08 23:39:44 2010 -0500
@@ -224,6 +224,7 @@
m = diffre.search(payload)
if m:
hgpatch = False
+ hgpatchheader = False
ignoretext = False
ui.debug('found patch at byte %d\n' % m.start(0))
@@ -232,12 +233,12 @@
for line in payload[:m.start(0)].splitlines():
if line.startswith('# HG changeset patch'):
ui.debug('patch generated by hg export\n')
- hgpatch = True
+ hgpatchheader = True
# drop earlier commit message content
cfp.seek(0)
cfp.truncate()
subject = None
- elif hgpatch:
+ elif hgpatchheader:
if line.startswith('# User '):
user = line[7:]
ui.debug('From: %s\n' % user)
@@ -249,9 +250,12 @@
nodeid = line[10:]
elif line.startswith("# Parent "):
parents.append(line[10:])
+ elif not line.startswith("# "):
+ hgpatchheader = False
+ hgpatch = True
elif line == '---' and gitsendmail:
ignoretext = True
- if not line.startswith('# ') and not ignoretext:
+ if not hgpatchheader and not ignoretext:
cfp.write(line)
cfp.write('\n')
message = cfp.getvalue()