comparison mercurial/patch.py @ 16484:1f75c1decdeb stable

patch: be more tolerant with "Parent" header (issue3356) Here is how export and mq write the "Parent" header: mq: # Parent XXXXX export: # Parent XXXXX then import expects exactly 2 spaces while mq tolerates one or more. So "hg import --exact" truncates mq generated patches header by one character and fails. This patch aligns import "Parent" header parsing on mq one. I do not expect spaces in parent references anytime soon. Reported by Stefan Ring <stefanrin@gmail.com>
author Patrick Mezard <patrick@mezard.eu>
date Fri, 20 Apr 2012 19:11:54 +0200
parents d23197e08d05
children fc4e0fecf403
comparison
equal deleted inserted replaced
16474:ee553e6cd8c4 16484:1f75c1decdeb
228 elif line.startswith("# Branch "): 228 elif line.startswith("# Branch "):
229 branch = line[9:] 229 branch = line[9:]
230 elif line.startswith("# Node ID "): 230 elif line.startswith("# Node ID "):
231 nodeid = line[10:] 231 nodeid = line[10:]
232 elif line.startswith("# Parent "): 232 elif line.startswith("# Parent "):
233 parents.append(line[10:]) 233 parents.append(line[9:].lstrip())
234 elif not line.startswith("# "): 234 elif not line.startswith("# "):
235 hgpatchheader = False 235 hgpatchheader = False
236 elif line == '---' and gitsendmail: 236 elif line == '---' and gitsendmail:
237 ignoretext = True 237 ignoretext = True
238 if not hgpatchheader and not ignoretext: 238 if not hgpatchheader and not ignoretext: