changeset 4497:711668818508

test: introduce a more complete test for phase-divergence The test the preservation of "change" cancellation in multiple situation.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 10 Apr 2019 20:43:42 +0200
parents 02d3177085e1
children 99dbe605fda5
files tests/test-evolve-phase-divergence.t
diffstat 1 files changed, 413 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-evolve-phase-divergence.t	Wed Apr 10 20:24:55 2019 +0200
+++ b/tests/test-evolve-phase-divergence.t	Wed Apr 10 20:43:42 2019 +0200
@@ -1403,3 +1403,416 @@
 XXX: we should handle phase-divergent merges
   $ hg evolve --phase-divergent
   skipping 8d4acf488ab5 : we do not handle merge yet
+
+Check we preserve "cancelation" of changes
+==========================================
+
+This tests case where the phase divergence changesets cancelled some of the
+change made by the public predecessors. The cancellation of these changes need
+to be preserved.
+
+  $ hg init cancelled-changes
+  $ cd cancelled-changes
+  $ cat << EOF > numbers
+  > 1
+  > 2
+  > 3
+  > 4
+  > 5
+  > 6
+  > 7
+  > 8
+  > 9
+  > EOF
+  $ cat << EOF > letters
+  > a
+  > b
+  > c
+  > d
+  > e
+  > f
+  > g
+  > h
+  > i
+  > EOF
+  $ cat << EOF > romans
+  > I
+  > II
+  > III
+  > IV
+  > V
+  > VI
+  > VII
+  > VIII
+  > IX
+  > EOF
+  $ hg add numbers letters romans
+  $ hg commit -m root
+  $ cat << EOF > numbers
+  > 1
+  > 2
+  > 3
+  > four
+  > 5
+  > 6
+  > 7
+  > 8
+  > nine
+  > EOF
+  $ cat << EOF > letters
+  > a
+  > b
+  > c
+  > D
+  > e
+  > f
+  > g
+  > h
+  > i
+  > EOF
+  $ hg commit -m E1
+  $ cat << EOF > numbers
+  > 1
+  > 2
+  > 3
+  > 4
+  > 5
+  > 6
+  > seven
+  > 8
+  > nine
+  > EOF
+  $ cat << EOF > letters
+  > a
+  > b
+  > c
+  > d
+  > e
+  > f
+  > g
+  > h
+  > i
+  > EOF
+  $ cat << EOF > romans
+  > I
+  > ii
+  > III
+  > IV
+  > V
+  > VI
+  > VII
+  > VIII
+  > IX
+  > EOF
+  $ hg commit --amend -m E2
+  $ hg --hidden phase --public --rev 'desc(E1)'
+  1 new phase-divergent changesets
+  $ hg log -G --patch --hidden --rev 'not desc("root")'
+  @  changeset:   2:599454370881
+  |  tag:         tip
+  ~  parent:      0:6d1fdf6de7e2
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     instability: phase-divergent
+     summary:     E2
+  
+     diff -r 6d1fdf6de7e2 -r 599454370881 numbers
+     --- a/numbers	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/numbers	Thu Jan 01 00:00:00 1970 +0000
+     @@ -4,6 +4,6 @@
+      4
+      5
+      6
+     -7
+     +seven
+      8
+     -9
+     +nine
+     diff -r 6d1fdf6de7e2 -r 599454370881 romans
+     --- a/romans	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/romans	Thu Jan 01 00:00:00 1970 +0000
+     @@ -1,5 +1,5 @@
+      I
+     -II
+     +ii
+      III
+      IV
+      V
+  
+  o  changeset:   1:3074c7249d20
+  |  user:        test
+  ~  date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     E1
+  
+     diff -r 6d1fdf6de7e2 -r 3074c7249d20 letters
+     --- a/letters	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/letters	Thu Jan 01 00:00:00 1970 +0000
+     @@ -1,7 +1,7 @@
+      a
+      b
+      c
+     -d
+     +D
+      e
+      f
+      g
+     diff -r 6d1fdf6de7e2 -r 3074c7249d20 numbers
+     --- a/numbers	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/numbers	Thu Jan 01 00:00:00 1970 +0000
+     @@ -1,9 +1,9 @@
+      1
+      2
+      3
+     -4
+     +four
+      5
+      6
+      7
+      8
+     -9
+     +nine
+  
+  $ hg evolve --list
+  599454370881: E2
+    phase-divergent: 3074c7249d20 (immutable precursor)
+  
+  $ hg obslog --all --patch
+  @  599454370881 (2) E2
+  |
+  o  3074c7249d20 (1) E1
+       rewritten(description, content) as 599454370881 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 3074c7249d20 -r 599454370881 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -E1
+         +E2
+  
+         diff -r 3074c7249d20 -r 599454370881 letters
+         --- a/letters	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/letters	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,7 +1,7 @@
+          a
+          b
+          c
+         -D
+         +d
+          e
+          f
+          g
+         diff -r 3074c7249d20 -r 599454370881 numbers
+         --- a/numbers	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/numbers	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,9 +1,9 @@
+          1
+          2
+          3
+         -four
+         +4
+          5
+          6
+         -7
+         +seven
+          8
+          nine
+         diff -r 3074c7249d20 -r 599454370881 romans
+         --- a/romans	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/romans	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,5 +1,5 @@
+          I
+         -II
+         +ii
+          III
+          IV
+          V
+  
+  
+
+  $ hg evolve --phase-divergent --rev 'desc("E2")'
+  recreate:[2] E2
+  atop:[1] E1
+  committed as 9eebcb77a7e2
+  working directory is now at 9eebcb77a7e2
+  $ hg export
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 9eebcb77a7e2b240cb7dce095bbe608b5de91cc8
+  # Parent  3074c7249d2023b1fff891591d7e609695cd09c2
+  phase-divergent update to 3074c7249d20:
+  
+  E2
+  
+  diff -r 3074c7249d20 -r 9eebcb77a7e2 letters
+  --- a/letters	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/letters	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,7 +1,7 @@
+   a
+   b
+   c
+  -D
+  +d
+   e
+   f
+   g
+  diff -r 3074c7249d20 -r 9eebcb77a7e2 numbers
+  --- a/numbers	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/numbers	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,9 +1,9 @@
+   1
+   2
+   3
+  -four
+  +4
+   5
+   6
+  -7
+  +seven
+   8
+   nine
+  diff -r 3074c7249d20 -r 9eebcb77a7e2 romans
+  --- a/romans	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/romans	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,5 +1,5 @@
+   I
+  -II
+  +ii
+   III
+   IV
+   V
+  $ hg log -G --patch --rev 'not desc("root")'
+  @  changeset:   3:9eebcb77a7e2
+  |  tag:         tip
+  |  parent:      1:3074c7249d20
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     phase-divergent update to 3074c7249d20:
+  |
+  |  diff -r 3074c7249d20 -r 9eebcb77a7e2 letters
+  |  --- a/letters	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/letters	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,7 +1,7 @@
+  |   a
+  |   b
+  |   c
+  |  -D
+  |  +d
+  |   e
+  |   f
+  |   g
+  |  diff -r 3074c7249d20 -r 9eebcb77a7e2 numbers
+  |  --- a/numbers	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/numbers	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,9 +1,9 @@
+  |   1
+  |   2
+  |   3
+  |  -four
+  |  +4
+  |   5
+  |   6
+  |  -7
+  |  +seven
+  |   8
+  |   nine
+  |  diff -r 3074c7249d20 -r 9eebcb77a7e2 romans
+  |  --- a/romans	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/romans	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,5 +1,5 @@
+  |   I
+  |  -II
+  |  +ii
+  |   III
+  |   IV
+  |   V
+  |
+  o  changeset:   1:3074c7249d20
+  |  user:        test
+  ~  date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     E1
+  
+     diff -r 6d1fdf6de7e2 -r 3074c7249d20 letters
+     --- a/letters	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/letters	Thu Jan 01 00:00:00 1970 +0000
+     @@ -1,7 +1,7 @@
+      a
+      b
+      c
+     -d
+     +D
+      e
+      f
+      g
+     diff -r 6d1fdf6de7e2 -r 3074c7249d20 numbers
+     --- a/numbers	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/numbers	Thu Jan 01 00:00:00 1970 +0000
+     @@ -1,9 +1,9 @@
+      1
+      2
+      3
+     -4
+     +four
+      5
+      6
+      7
+      8
+     -9
+     +nine
+  
+  $ hg obslog --patch
+  @  9eebcb77a7e2 (3) phase-divergent update to 3074c7249d20:
+  |
+  x  599454370881 (2) E2
+  |    rewritten(description, parent, content) as 9eebcb77a7e2 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |      (No patch available, changesets rebased)
+  |
+  o  3074c7249d20 (1) E1
+       rewritten(description, content) as 599454370881 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+         diff -r 3074c7249d20 -r 599454370881 changeset-description
+         --- a/changeset-description
+         +++ b/changeset-description
+         @@ -1,1 +1,1 @@
+         -E1
+         +E2
+  
+         diff -r 3074c7249d20 -r 599454370881 letters
+         --- a/letters	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/letters	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,7 +1,7 @@
+          a
+          b
+          c
+         -D
+         +d
+          e
+          f
+          g
+         diff -r 3074c7249d20 -r 599454370881 numbers
+         --- a/numbers	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/numbers	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,9 +1,9 @@
+          1
+          2
+          3
+         -four
+         +4
+          5
+          6
+         -7
+         +seven
+          8
+          nine
+         diff -r 3074c7249d20 -r 599454370881 romans
+         --- a/romans	Thu Jan 01 00:00:00 1970 +0000
+         +++ b/romans	Thu Jan 01 00:00:00 1970 +0000
+         @@ -1,5 +1,5 @@
+          I
+         -II
+         +ii
+          III
+          IV
+          V
+  
+  
+  $ cd ..