diff hgext/mq.py @ 22521:3f948469bac0

mq: write '# Parent ' lines with two spaces like export does (BC) This aligns "Parent" node IDs with "Node ID" node IDs.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 24 Sep 2014 01:36:44 +0200
parents 9d4ebb75de53
children 382c2be610dc
line wrap: on
line diff
--- 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