Patchwork [3,of,8] mq: write '# Parent ' lines with two spaces like export does

login
register
mail settings
Submitter Mads Kiilerich
Date Sept. 24, 2014, 1 a.m.
Message ID <746ea8e313f052ebdb26.1411520404@localhost.localdomain>
Download mbox | patch
Permalink /patch/5950/
State Accepted
Headers show

Comments

Mads Kiilerich - Sept. 24, 2014, 1 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1411515404 -7200
#      Wed Sep 24 01:36:44 2014 +0200
# Node ID 746ea8e313f052ebdb2618bfa549b9e9a9b9dff1
# Parent  ad1c120809ec524aef939a1235752f9b2f4742c7
mq: write '# Parent  ' lines with two spaces like export does

This aligns "Parent" node IDs with "Node ID" node IDs.

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -150,7 +150,7 @@  class patchheader(object):
                 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 @@  class patchheader(object):
         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 @@  class queue(object):
                         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
diff --git a/tests/test-mq-git.t b/tests/test-mq-git.t
--- a/tests/test-mq-git.t
+++ b/tests/test-mq-git.t
@@ -18,7 +18,7 @@  git=auto: regular patch creation:
   $ 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 @@  git=auto: git patch creation with copy:
   $ 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 @@  git=auto: git patch when using --git:
   $ 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 @@  git=auto: regular patch after qrefresh w
   $ cat .hg/patches/git
   # HG changeset patch
   # Date 0 0
-  # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
+  # Parent  99586d5f048c399e20f81cee41fbb3809c0e735d
   
   diff -r 99586d5f048c regular
   --- /dev/null
@@ -89,7 +89,7 @@  git=keep: git patch with --git:
   $ 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 @@  git=keep: git patch after qrefresh witho
   $ 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 @@  git=yes: git patch:
   $ 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 @@  git=yes: git patch after qrefresh:
   $ 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 @@  git=no: regular patch with copy:
   $ 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 @@  git=no: regular patch after qrefresh wit
   $ cat .hg/patches/regular
   # HG changeset patch
   # Date 0 0
-  # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
+  # Parent  ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
   
   diff -r ef8dafc9fa4c b
   --- /dev/null
diff --git a/tests/test-mq-merge.t b/tests/test-mq-merge.t
--- a/tests/test-mq-merge.t
+++ b/tests/test-mq-merge.t
@@ -138,7 +138,7 @@  Check patcha is still a git patch:
 
   $ cat .hg/patches/patcha
   # HG changeset patch
-  # Parent d3873e73d99ef67873dac33fbcc66268d5d2b6f4
+  # Parent  d3873e73d99ef67873dac33fbcc66268d5d2b6f4
   
   diff --git a/a b/a
   --- a/a
@@ -161,7 +161,7 @@  Check patcha2 is still a regular patch:
   $ cat .hg/patches/patcha2
   # HG changeset patch
   # Date 0 0
-  # Parent ???????????????????????????????????????? (glob)
+  # Parent  ???????????????????????????????????????? (glob)
   
   diff -r ???????????? -r ???????????? a (glob)
   --- a/a
diff --git a/tests/test-mq-qfold.t b/tests/test-mq-qfold.t
--- a/tests/test-mq-qfold.t
+++ b/tests/test-mq-qfold.t
@@ -87,7 +87,7 @@  Fold git patch into a regular patch, exp
 
   $ cat .hg/patches/regular
   # HG changeset patch
-  # Parent ???????????????????????????????????????? (glob)
+  # Parent  ???????????????????????????????????????? (glob)
   
   diff --git a/a b/a
   --- a/a
@@ -129,7 +129,7 @@  Fold regular patch into a git patch, exp
 
   $ cat .hg/patches/git
   # HG changeset patch
-  # Parent ???????????????????????????????????????? (glob)
+  # Parent  ???????????????????????????????????????? (glob)
   
   diff --git a/a b/aa
   copy from a
diff --git a/tests/test-mq-qnew.t b/tests/test-mq-qnew.t
--- a/tests/test-mq-qnew.t
+++ b/tests/test-mq-qnew.t
@@ -339,7 +339,7 @@  Test handling default message with the p
   ====
   $ cat ".hg/patches/patch "
   # HG changeset patch
-  # Parent 0000000000000000000000000000000000000000
+  # Parent  0000000000000000000000000000000000000000
   
 
   $ cd ..
diff --git a/tests/test-mq-qrefresh.t b/tests/test-mq-qrefresh.t
--- a/tests/test-mq-qrefresh.t
+++ b/tests/test-mq-qrefresh.t
@@ -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 @@  qrefresh . in subdir:
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 1/base
@@ -186,7 +186,7 @@  qrefresh in hg-root again:
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 1/base
@@ -234,7 +234,7 @@  qrefresh --short tests:
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 1/base
@@ -267,7 +267,7 @@  Before starting exclusive tests:
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 1/base
@@ -289,7 +289,7 @@  Exclude 2/base:
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 1/base
@@ -312,7 +312,7 @@  Remove 1/base and add 2/base again but n
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 2/base
@@ -328,7 +328,7 @@  Add 1/base with include filter - and thu
 
   $ cat .hg/patches/mqbase
   # HG changeset patch
-  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  # Parent  e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
   mqbase
   
   diff -r e7af5904b465 1/base
@@ -453,7 +453,7 @@  refresh with tip != qtip:
 
   $ cat .hg/patches/patch
   # HG changeset patch
-  # Parent 1a60229be7ac3e4a7f647508e99b87bef1f03593
+  # Parent  1a60229be7ac3e4a7f647508e99b87bef1f03593
   
   diff -r 1a60229be7ac b
   --- a/b
@@ -507,7 +507,7 @@  but only after writing the bad name into
   $ 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 @@  but only after writing the bad name into
   [255]
   $ cat .hg/patches/a
   # HG changeset patch
-  # Parent 0000000000000000000000000000000000000000
+  # Parent  0000000000000000000000000000000000000000
   
   diff --git a/a b/a
   new file mode 100644
diff --git a/tests/test-mq-qrename.t b/tests/test-mq-qrename.t
--- a/tests/test-mq-qrename.t
+++ b/tests/test-mq-qrename.t
@@ -113,7 +113,7 @@  Test renaming to a folded patch (issue30
   $ hg qmv addb
   $ cat .hg/patches/addb
   # HG changeset patch
-  # Parent 0000000000000000000000000000000000000000
+  # Parent  0000000000000000000000000000000000000000
   
   diff -r 000000000000 a
   --- /dev/null	* (glob)
diff --git a/tests/test-mq-subrepo.t b/tests/test-mq-subrepo.t
--- a/tests/test-mq-subrepo.t
+++ b/tests/test-mq-subrepo.t
@@ -421,7 +421,7 @@  both into 'revision' and 'patch file und
   # HG changeset patch
   # User test
   # Date 0 0
-  # Parent f499373e340cdca5d01dee904aeb42dd2a325e71
+  # Parent  f499373e340cdca5d01dee904aeb42dd2a325e71
   
   diff -r f499373e340c -r f69e96d86e75 .hgsub
   --- /dev/null
@@ -484,7 +484,7 @@  check whether qrefresh imports updated .
   # HG changeset patch
   # Date 0 0
   # User test
-  # Parent 05b056bb9c8c05ff15258b84fd42ab3527271033
+  # Parent  05b056bb9c8c05ff15258b84fd42ab3527271033
   
   diff -r 05b056bb9c8c .hgsubstate
   --- a/.hgsubstate
@@ -509,7 +509,7 @@  check whether qrefresh imports updated .
   # HG changeset patch
   # Date 0 0
   # User test
-  # Parent 05b056bb9c8c05ff15258b84fd42ab3527271033
+  # Parent  05b056bb9c8c05ff15258b84fd42ab3527271033
   
   diff -r 05b056bb9c8c .hgsubstate
   --- a/.hgsubstate
@@ -556,7 +556,7 @@  check whether qrefresh imports updated .
   # HG changeset patch
   # User test
   # Date 0 0
-  # Parent 4d91eb2fa1d1b22ec513347b9cd06f6b49d470fa
+  # Parent  4d91eb2fa1d1b22ec513347b9cd06f6b49d470fa
   
   diff -r 4d91eb2fa1d1 -r 1259c112d884 .hgsubstate
   --- a/.hgsubstate