comparison 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
comparison
equal deleted inserted replaced
12727:52971985be14 12728:80a3d1121c10
226 226
227 ui.debug('found patch at byte %d\n' % m.start(0)) 227 ui.debug('found patch at byte %d\n' % m.start(0))
228 diffs_seen += 1 228 diffs_seen += 1
229 cfp = cStringIO.StringIO() 229 cfp = cStringIO.StringIO()
230 for line in payload[:m.start(0)].splitlines(): 230 for line in payload[:m.start(0)].splitlines():
231 if line.startswith('# HG changeset patch'): 231 if line.startswith('# HG changeset patch') and not hgpatch:
232 ui.debug('patch generated by hg export\n') 232 ui.debug('patch generated by hg export\n')
233 hgpatch = True
233 hgpatchheader = True 234 hgpatchheader = True
234 # drop earlier commit message content 235 # drop earlier commit message content
235 cfp.seek(0) 236 cfp.seek(0)
236 cfp.truncate() 237 cfp.truncate()
237 subject = None 238 subject = None
247 nodeid = line[10:] 248 nodeid = line[10:]
248 elif line.startswith("# Parent "): 249 elif line.startswith("# Parent "):
249 parents.append(line[10:]) 250 parents.append(line[10:])
250 elif not line.startswith("# "): 251 elif not line.startswith("# "):
251 hgpatchheader = False 252 hgpatchheader = False
252 hgpatch = True
253 elif line == '---' and gitsendmail: 253 elif line == '---' and gitsendmail:
254 ignoretext = True 254 ignoretext = True
255 if not hgpatchheader and not ignoretext: 255 if not hgpatchheader and not ignoretext:
256 cfp.write(line) 256 cfp.write(line)
257 cfp.write('\n') 257 cfp.write('\n')