diff mercurial/patch.py @ 16475: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
line wrap: on
line diff
--- a/mercurial/patch.py	Thu Apr 19 17:08:12 2012 +0200
+++ b/mercurial/patch.py	Fri Apr 20 19:11:54 2012 +0200
@@ -230,7 +230,7 @@
                         elif line.startswith("# Node ID "):
                             nodeid = line[10:]
                         elif line.startswith("# Parent "):
-                            parents.append(line[10:])
+                            parents.append(line[9:].lstrip())
                         elif not line.startswith("# "):
                             hgpatchheader = False
                     elif line == '---' and gitsendmail: