diff mercurial/patch.py @ 12728:80a3d1121c10

import: only the first hg patch marker should be processed (issue2417) Proper use of the hgpatch state variable had been lost in the final edits of d7452292f9d3 - now it works more like intended.
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 14 Oct 2010 01:28:29 +0200
parents c6cdc123f6e4
children 61f48581d8ef
line wrap: on
line diff
--- a/mercurial/patch.py	Fri Sep 10 10:28:18 2010 +0200
+++ b/mercurial/patch.py	Thu Oct 14 01:28:29 2010 +0200
@@ -228,8 +228,9 @@
                 diffs_seen += 1
                 cfp = cStringIO.StringIO()
                 for line in payload[:m.start(0)].splitlines():
-                    if line.startswith('# HG changeset patch'):
+                    if line.startswith('# HG changeset patch') and not hgpatch:
                         ui.debug('patch generated by hg export\n')
+                        hgpatch = True
                         hgpatchheader = True
                         # drop earlier commit message content
                         cfp.seek(0)
@@ -249,7 +250,6 @@
                             parents.append(line[10:])
                         elif not line.startswith("# "):
                             hgpatchheader = False
-                            hgpatch = True
                     elif line == '---' and gitsendmail:
                         ignoretext = True
                     if not hgpatchheader and not ignoretext: