hgext/mq.py
changeset 22521 3f948469bac0
parent 22520 9d4ebb75de53
child 22522 382c2be610dc
--- a/hgext/mq.py	Sat Sep 20 17:06:56 2014 +0200
+++ b/hgext/mq.py	Wed Sep 24 01:36:44 2014 +0200
@@ -150,7 +150,7 @@
                 elif line.startswith("# Date "):
                     date = line[7:]
                 elif line.startswith("# Parent "):
-                    parent = line[9:].lstrip()
+                    parent = line[9:].lstrip() # handle double trailing space
                 elif line.startswith("# Branch "):
                     branch = line[9:]
                 elif line.startswith("# Node ID "):
@@ -232,10 +232,11 @@
         self.date = date
 
     def setparent(self, parent):
-        if not self.updateheader(['# Parent '], parent):
+        if not (self.updateheader(['# Parent  '], parent) or
+                self.updateheader(['# Parent '], parent)):
             try:
                 patchheaderat = self.comments.index('# HG changeset patch')
-                self.comments.insert(patchheaderat + 1, '# Parent ' + parent)
+                self.comments.insert(patchheaderat + 1, '# Parent  ' + parent)
             except ValueError:
                 pass
         self.parent = parent
@@ -1081,7 +1082,7 @@
                         p.write("# User " + user + "\n")
                     if date:
                         p.write("# Date %s %s\n" % date)
-                    p.write("# Parent "
+                    p.write("# Parent  "
                             + hex(repo[None].p1().node()) + "\n")
 
                 defaultmsg = "[mq]: %s" % patchfn