mq: write '# Parent ' lines with two spaces like export does (BC)
authorMads Kiilerich <madski@unity3d.com>
Wed, 24 Sep 2014 01:36:44 +0200
changeset 22521 3f948469bac0
parent 22520 9d4ebb75de53
child 22522 382c2be610dc
mq: write '# Parent ' lines with two spaces like export does (BC) This aligns "Parent" node IDs with "Node ID" node IDs.
hgext/mq.py
tests/test-mq-git.t
tests/test-mq-merge.t
tests/test-mq-qfold.t
tests/test-mq-qnew.t
tests/test-mq-qrefresh.t
tests/test-mq-qrename.t
tests/test-mq-subrepo.t
--- 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
--- a/tests/test-mq-git.t	Sat Sep 20 17:06:56 2014 +0200
+++ b/tests/test-mq-git.t	Wed Sep 24 01:36:44 2014 +0200
@@ -18,7 +18,7 @@
   $ cat .hg/patches/adda
   # HG changeset patch
   # Date 0 0
-  # Parent 0000000000000000000000000000000000000000
+  # Parent  0000000000000000000000000000000000000000
   
   diff -r 000000000000 -r ef8dafc9fa4c a
   --- /dev/null
@@ -34,7 +34,7 @@
   $ cat .hg/patches/copy
   # HG changeset patch
   # Date 0 0
-  # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
+  # Parent  ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
   
   diff --git a/a b/b
   copy from a
@@ -49,7 +49,7 @@
   $ cat .hg/patches/git
   # HG changeset patch
   # Date 0 0
-  # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
+  # Parent  99586d5f048c399e20f81cee41fbb3809c0e735d
   
   diff --git a/regular b/regular
   new file mode 100644
@@ -65,7 +65,7 @@
   $ cat .hg/patches/git
   # HG changeset patch
   # Date 0 0
-  # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
+  # Parent  99586d5f048c399e20f81cee41fbb3809c0e735d
   
   diff -r 99586d5f048c regular
   --- /dev/null
@@ -89,7 +89,7 @@
   $ cat .hg/patches/git
   # HG changeset patch
   # Date 0 0
-  # Parent 0000000000000000000000000000000000000000
+  # Parent  0000000000000000000000000000000000000000
   
   diff --git a/a b/a
   new file mode 100644
@@ -106,7 +106,7 @@
   $ cat .hg/patches/git
   # HG changeset patch
   # Date 0 0
-  # Parent 0000000000000000000000000000000000000000
+  # Parent  0000000000000000000000000000000000000000
   
   diff --git a/a b/a
   new file mode 100644
@@ -131,7 +131,7 @@
   $ cat .hg/patches/git
   # HG changeset patch
   # Date 0 0
-  # Parent 0000000000000000000000000000000000000000
+  # Parent  0000000000000000000000000000000000000000
   
   diff --git a/a b/a
   new file mode 100644
@@ -148,7 +148,7 @@
   $ cat .hg/patches/git
   # HG changeset patch
   # Date 0 0
-  # Parent 0000000000000000000000000000000000000000
+  # Parent  0000000000000000000000000000000000000000
   
   diff --git a/a b/a
   new file mode 100644
@@ -177,7 +177,7 @@
   $ cat .hg/patches/regular
   # HG changeset patch
   # Date 0 0
-  # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
+  # Parent  ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
   
   diff -r ef8dafc9fa4c -r a70404f79ba3 b
   --- /dev/null
@@ -193,7 +193,7 @@
   $ cat .hg/patches/regular
   # HG changeset patch
   # Date 0 0
-  # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
+  # Parent  ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
   
   diff -r ef8dafc9fa4c b
   --- /dev/null
--- a/tests/test-mq-merge.t	Sat Sep 20 17:06:56 2014 +0200
+++ b/tests/test-mq-merge.t	Wed Sep 24 01:36:44 2014 +0200
@@ -138,7 +138,7 @@
 
   $ cat .hg/patches/patcha
   # HG changeset patch
-  # Parent d3873e73d99ef67873dac33fbcc66268d5d2b6f4
+  # Parent  d3873e73d99ef67873dac33fbcc66268d5d2b6f4
   
   diff --git a/a b/a
   --- a/a
@@ -161,7 +161,7 @@
   $ cat .hg/patches/patcha2
   # HG changeset patch
   # Date 0 0
-  # Parent ???????????????????????????????????????? (glob)
+  # Parent  ???????????????????????????????????????? (glob)
   
   diff -r ???????????? -r ???????????? a (glob)
   --- a/a
--- a/tests/test-mq-qfold.t	Sat Sep 20 17:06:56 2014 +0200
+++ b/tests/test-mq-qfold.t	Wed Sep 24 01:36:44 2014 +0200
@@ -87,7 +87,7 @@
 
   $ cat .hg/patches/regular
   # HG changeset patch
-  # Parent ???????????????????????????????????????? (glob)
+  # Parent  ???????????????????????????????????????? (glob)
   
   diff --git a/a b/a
   --- a/a
@@ -129,7 +129,7 @@
 
   $ cat .hg/patches/git
   # HG changeset patch
-  # Parent ???????????????????????????????????????? (glob)
+  # Parent  ???????????????????????????????????????? (glob)
   
   diff --git a/a b/aa
   copy from a
--- a/tests/test-mq-qnew.t	Sat Sep 20 17:06:56 2014 +0200
+++ b/tests/test-mq-qnew.t	Wed Sep 24 01:36:44 2014 +0200
@@ -339,7 +339,7 @@
   ====
   $ cat ".hg/patches/patch "
   # HG changeset patch
-  # Parent 0000000000000000000000000000000000000000
+  # Parent  0000000000000000000000000000000000000000
   
 
   $ cd ..
--- a/tests/test-mq-qrefresh.t	Sat Sep 20 17:06:56 2014 +0200
+++ b/tests/test-mq-qrefresh.t	Wed Sep 24 01:36:44 2014 +0200
@@ -49,7 +49,7 @@
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 1/base
@@ -98,7 +98,7 @@
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 1/base
@@ -142,7 +142,7 @@
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 1/base
@@ -186,7 +186,7 @@
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 1/base
@@ -234,7 +234,7 @@
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 1/base
@@ -267,7 +267,7 @@
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 1/base
@@ -289,7 +289,7 @@
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 1/base
@@ -312,7 +312,7 @@
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 2/base
@@ -328,7 +328,7 @@
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 1/base
@@ -453,7 +453,7 @@
 
   $ cat .hg/patches/patch
   # HG changeset patch
-  # Parent 1a60229be7ac3e4a7f647508e99b87bef1f03593
+  # Parent  1a60229be7ac3e4a7f647508e99b87bef1f03593
   
   diff -r 1a60229be7ac b
   --- a/b
@@ -507,7 +507,7 @@
   $ rm a
   $ cat .hg/patches/a
   # HG changeset patch
-  # Parent 0000000000000000000000000000000000000000
+  # Parent  0000000000000000000000000000000000000000
   
   diff --git a/a b/a
   new file mode 100644
@@ -522,7 +522,7 @@
   [255]
   $ cat .hg/patches/a
   # HG changeset patch
-  # Parent 0000000000000000000000000000000000000000
+  # Parent  0000000000000000000000000000000000000000
   
   diff --git a/a b/a
   new file mode 100644
--- a/tests/test-mq-qrename.t	Sat Sep 20 17:06:56 2014 +0200
+++ b/tests/test-mq-qrename.t	Wed Sep 24 01:36:44 2014 +0200
@@ -113,7 +113,7 @@
   $ hg qmv addb
   $ cat .hg/patches/addb
   # HG changeset patch
-  # Parent 0000000000000000000000000000000000000000
+  # Parent  0000000000000000000000000000000000000000
   
   diff -r 000000000000 a
   --- /dev/null	* (glob)
--- a/tests/test-mq-subrepo.t	Sat Sep 20 17:06:56 2014 +0200
+++ b/tests/test-mq-subrepo.t	Wed Sep 24 01:36:44 2014 +0200
@@ -421,7 +421,7 @@
   # HG changeset patch
   # User test
   # Date 0 0
-  # Parent f499373e340cdca5d01dee904aeb42dd2a325e71
+  # Parent  f499373e340cdca5d01dee904aeb42dd2a325e71
   
   diff -r f499373e340c -r f69e96d86e75 .hgsub
   --- /dev/null
@@ -484,7 +484,7 @@
   # HG changeset patch
   # Date 0 0
   # User test
-  # Parent 05b056bb9c8c05ff15258b84fd42ab3527271033
+  # Parent  05b056bb9c8c05ff15258b84fd42ab3527271033
   
   diff -r 05b056bb9c8c .hgsubstate
   --- a/.hgsubstate
@@ -509,7 +509,7 @@
   # HG changeset patch
   # Date 0 0
   # User test
-  # Parent 05b056bb9c8c05ff15258b84fd42ab3527271033
+  # Parent  05b056bb9c8c05ff15258b84fd42ab3527271033
   
   diff -r 05b056bb9c8c .hgsubstate
   --- a/.hgsubstate
@@ -556,7 +556,7 @@
   # HG changeset patch
   # User test
   # Date 0 0
-  # Parent 4d91eb2fa1d1b22ec513347b9cd06f6b49d470fa
+  # Parent  4d91eb2fa1d1b22ec513347b9cd06f6b49d470fa
   
   diff -r 4d91eb2fa1d1 -r 1259c112d884 .hgsubstate
   --- a/.hgsubstate