tests: add tests for divergence resolution with split+amend
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 28 Mar 2019 14:54:46 -0700
changeset 4456 b0d755a95f6c
parent 4455 b58e45aa9be2
child 4457 218fa7c1fe4b
tests: add tests for divergence resolution with split+amend As suggested by Boris Feld. G: changed tests/test-evolve-phase-divergence.t
tests/test-evolve-phase-divergence.t
--- a/tests/test-evolve-phase-divergence.t	Tue Mar 26 12:53:50 2019 +0100
+++ b/tests/test-evolve-phase-divergence.t	Thu Mar 28 14:54:46 2019 -0700
@@ -49,6 +49,7 @@
   $ cp -a private bob
   $ cp -a private split
   $ cp -a private split-across-branches
+  $ cp -a private split-and-amend
   $ cp -a private merge-no-conflict
 
 Creating a phase-divergence changeset
@@ -1152,6 +1153,129 @@
   @@ -1,1 +0,0 @@
   -q
 
+When the public changeset is split and amended
+--------------------------------------------------------------
+
+  $ cd ../split-and-amend
+
+  $ echo m > m
+  $ echo n > n
+  $ hg ci -Aqm "added m and n"
+  $ hg prev
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  [0] init
+  $ echo m > m
+  $ hg ci -Aqm "added m"
+  $ echo n > n
+  $ hg ci -Aqm "added n"
+
+  $ hg glog
+  @  3:e1154ec0206a added n
+  |   () draft
+  o  2:4f25cd9cd2bf added m
+  |   () draft
+  | o  1:a51bce62c219 added m and n
+  |/    () draft
+  o  0:d3873e73d99e init
+      () public
+
+  $ hg prune -r a51bce62c219 --succ 4f25cd9cd2bf --succ e1154ec0206a --split
+  1 changesets pruned
+
+  $ echo n2 > n
+  $ hg amend
+
+  $ hg phase -r a51bce62c219 --public --hidden
+  2 new phase-divergent changesets
+
+  $ hg glog
+  @  4:52ca78bb98c7 added n
+  |   () draft
+  *  2:4f25cd9cd2bf added m
+  |   () draft
+  | o  1:a51bce62c219 added m and n
+  |/    () public
+  o  0:d3873e73d99e init
+      () public
+
+  $ hg evolve --list
+  4f25cd9cd2bf: added m
+    phase-divergent: a51bce62c219 (immutable precursor)
+  
+  52ca78bb98c7: added n
+    phase-divergent: a51bce62c219 (immutable precursor)
+  
+  $ hg evolve --all --phase-divergent
+  recreate:[2] added m
+  atop:[1] added m and n
+  committed as 86419909e017
+  1 new orphan changesets
+  recreate:[4] added n
+  atop:[1] added m and n
+  rebasing to destination parent: d3873e73d99e
+  committed as 88b0dae5369a
+  working directory is now at 88b0dae5369a
+
+  $ hg glog --hidden
+  @  7:88b0dae5369a phase-divergent update to a51bce62c219:
+  |   () draft
+  | x  6:98dad8812511 added n
+  | |   () draft
+  +---o  5:86419909e017 phase-divergent update to a51bce62c219:
+  | |     () draft
+  | | x  4:52ca78bb98c7 added n
+  | | |   () draft
+  | | | x  3:e1154ec0206a added n
+  | | |/    () draft
+  | | x  2:4f25cd9cd2bf added m
+  | |/    () draft
+  o |  1:a51bce62c219 added m and n
+  |/    () public
+  o  0:d3873e73d99e init
+      () public
+
+XXX: not sure this is correct
+  $ hg exp 86419909e017
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 86419909e01787959aa6471aee605c6d604a3e0d
+  # Parent  a51bce62c219f024bc0ae0cc0e3957ee77d7cb46
+  phase-divergent update to a51bce62c219:
+  
+  added m
+  
+  diff -r a51bce62c219 -r 86419909e017 n
+  --- a/n	Thu Jan 01 00:00:00 1970 +0000
+  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +0,0 @@
+  -n
+
+XXX: not sure this is correct
+  $ hg exp 88b0dae5369a
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 88b0dae5369aaa3bceb6c0b647542594e2c72fb7
+  # Parent  a51bce62c219f024bc0ae0cc0e3957ee77d7cb46
+  phase-divergent update to a51bce62c219:
+  
+  added n
+  
+  diff -r a51bce62c219 -r 88b0dae5369a m
+  --- a/m	Thu Jan 01 00:00:00 1970 +0000
+  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +0,0 @@
+  -m
+  diff -r a51bce62c219 -r 88b0dae5369a n
+  --- a/n	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/n	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,1 @@
+  -n
+  +n2
+
 Testing the evolution of a phase-divergent merge with no conflicts
 ------------------------------------------------------------------