tests/test-evolve-phase-divergence.t
branchstable
changeset 4507 de9089514833
parent 4498 99dbe605fda5
child 4512 7a779a288793
child 4576 96ce1030d2fb
--- a/tests/test-evolve-phase-divergence.t	Wed Apr 10 16:11:59 2019 +0200
+++ b/tests/test-evolve-phase-divergence.t	Thu Apr 11 22:13:55 2019 +0200
@@ -32,7 +32,9 @@
 Setting up a private non-publishing repo
 ----------------------------------------
 
-  $ hg clone -U public private
+  $ hg clone public private
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd private
   $ cat >> .hg/hgrc <<EOF
   > [ui]
@@ -47,6 +49,13 @@
 
   $ cp -a private alice
   $ 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
+
+Simple phase-divergence case
+============================
 
 Creating a phase-divergence changeset
 -------------------------------------
@@ -54,8 +63,6 @@
 Alice creating a draft changeset and pushing to main private repo
 
   $ cd alice
-  $ hg update
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ echo a >> a
   $ hg commit -u alice -m 'modify a'
   $ hg push ../private
@@ -88,7 +95,7 @@
   $ hg glog
   o  1:4d1169d82e47 modify a
   |   () draft
-  o  0:d3873e73d99e init
+  @  0:d3873e73d99e init
       () public
 
   $ hg push ../public
@@ -102,7 +109,7 @@
   $ hg glog
   o  1:4d1169d82e47 modify a
   |   () public
-  o  0:d3873e73d99e init
+  @  0:d3873e73d99e init
       () public
 
 *But* Alice decided to amend the changeset she had and then pulling from public
@@ -195,8 +202,7 @@
   $ hg evolve --phase-divergent
   recreate:[2] tweak a
   atop:[1] modify a
-  computing new diff
-  committed as 4d1169d82e47
+  no changes to commit
   working directory is now at 4d1169d82e47
 
   $ hg glog
@@ -227,9 +233,11 @@
   2 new obsolescence markers
   [1]
 
+phase-divergence that lead to new commit and bookmark movement
+==============================================================
+
 Creating more phase-divergence where a new resolution commit will be formed and
 also testing bookmark movement
---------------------------------------------------------------------------------
 
 Alice created a commit and push to private non-publishing repo
 
@@ -310,7 +318,6 @@
   $ hg evolve --phase-divergent
   recreate:[4] added bar to foo
   atop:[3] added foo to foo
-  computing new diff
   committed as 3d62500c673d
   working directory is now at 3d62500c673d
 
@@ -388,11 +395,14 @@
   added 1 changesets with 1 changes to 1 files
   2 new obsolescence markers
 
+
+phase divergence rebasing back to old changeset - with (unrelated?) conflict
+============================================================================
+
 Creating a phasedivergence changeset where the divergent changeset changed in a
 way that we rebase that on old public changeset, there will be conflicts, but
 the `hg evolve` command handles it very well and uses `hg revert` logic to
 prevent any conflicts
--------------------------------------------------------------------------------
 
 Alice creates one more changeset and pushes to private repo
 
@@ -461,7 +471,6 @@
   $ hg evolve --phase-divergent
   recreate:[7] foo to bar
   atop:[6] added bar to bar
-  computing new diff
   committed as 502e73736632
   working directory is now at 502e73736632
 
@@ -517,9 +526,11 @@
   added 1 changesets with 1 changes to 1 files
   2 new obsolescence markers
 
+different parents for successors and predecessors
+=================================================
+
 Creating phase-divergence with divergent changeset and precursor having
 different parents
------------------------------------------------------------------------
 
 Alice creates a changeset and pushes to private repo
 
@@ -598,8 +609,7 @@
   atop:[9] added x to x
   rebasing to destination parent: 502e73736632
   (leaving bookmark bm)
-  computing new diff
-  committed as 2352021b3785
+  no changes to commit
   working directory is now at 2352021b3785
 
 XXX: we should move bookmark here
@@ -645,9 +655,11 @@
   @@ -0,0 +1,1 @@
   +x
 
-Creating divergence with parent and content change both but not resulting in
+divergence with parent+content change both, no conflict
+=======================================================
+
+Creating divergence with parent cand content change both but not resulting in
 conflicts
------------------------------------------------------------------------------
 
 Alice is tired of pushing and pulling and will create phase-divergence locally
 
@@ -717,7 +729,6 @@
   recreate:[14] y to y and foobar to foo
   atop:[12] y to y and foobar to foo
   rebasing to destination parent: 2352021b3785
-  computing new diff
   committed as 8c2bb6fb44e9
   working directory is now at 8c2bb6fb44e9
 
@@ -759,9 +770,11 @@
   o  0:d3873e73d99e init
       () public
 
+divergence with parent+content change both, with conflict
+=========================================================
+
 Creating divergence with parent and content change both which results in
 conflicts while rebasing on parent
------------------------------------------------------------------------------
 
   $ echo l > l
   $ hg ci -Aqm "added l to l"
@@ -821,7 +834,6 @@
 
   $ hg evolve --continue
   evolving 19:5fd38c0de46e "added l to l"
-  computing new diff
   committed as e3090241a10c
   working directory is now at e3090241a10c
 
@@ -918,8 +930,7 @@
   recreate:[24] added f
   atop:[23] added g
   rebasing to destination parent: 21ae52e414e6
-  computing new diff
-  committed as 428f7900a969
+  no changes to commit
   working directory is now at 428f7900a969
 
   $ hg glog -r f3794e5a91dc::
@@ -933,127 +944,141 @@
   |   () public
   ~
 
-When the public changesets is splitted causing phase-divergence
----------------------------------------------------------------
+When the public changesets is split causing phase-divergence
+------------------------------------------------------------
+
+  $ cd ../split
 
   $ echo m > m
   $ echo n > n
   $ hg ci -Aqm "added m and n"
 
-  $ hg glog -r 21ae52e414e6::
-  @  26:849cee0a874b added m and n
+  $ hg glog
+  @  1:a51bce62c219 added m and n
   |   () draft
-  o  23:428f7900a969 added g
-  |   () public
-  o  22:21ae52e414e6 added f
-  |   () public
-  ~
+  o  0:d3873e73d99e init
+      () public
 
   $ hg prev
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  [23] added g
+  [0] init
   $ echo m > m
   $ hg ci -Aqm "added m"
   $ echo n > n
   $ hg ci -Aqm "added n"
 
-  $ hg glog -r 428f7900a969::
-  @  28:63ccb8ea7cae added n
+  $ hg glog
+  @  3:e1154ec0206a added n
   |   () draft
-  o  27:f313e2b90e70 added m
+  o  2:4f25cd9cd2bf added m
   |   () draft
-  | o  26:849cee0a874b added m and n
+  | o  1:a51bce62c219 added m and n
   |/    () draft
-  o  23:428f7900a969 added g
-  |   () public
-  ~
+  o  0:d3873e73d99e init
+      () public
 
-  $ hg prune -r 849cee0a874b --succ f313e2b90e70 --succ 63ccb8ea7cae --split
+  $ hg prune -r a51bce62c219 --succ 4f25cd9cd2bf --succ e1154ec0206a --split
   1 changesets pruned
 
-  $ hg phase -r 849cee0a874b --hidden --public
+  $ hg phase -r a51bce62c219 --hidden --public
   2 new phase-divergent changesets
 
-  $ hg glog -r 428f7900a969::
-  @  28:63ccb8ea7cae added n
+  $ hg glog
+  @  3:e1154ec0206a added n
   |   () draft
-  *  27:f313e2b90e70 added m
+  *  2:4f25cd9cd2bf added m
   |   () draft
-  | o  26:849cee0a874b added m and n
+  | o  1:a51bce62c219 added m and n
   |/    () public
-  o  23:428f7900a969 added g
-  |   () public
-  ~
+  o  0:d3873e73d99e init
+      () public
 
   $ hg evolve --all --phase-divergent
-  recreate:[27] added m
-  atop:[26] added m and n
-  computing new diff
-  committed as 870e1c3eddc3
+  recreate:[2] added m
+  atop:[1] added m and n
+  committed as 86419909e017
   1 new orphan changesets
-  recreate:[28] added n
-  atop:[26] added m and n
-  rebasing to destination parent: 428f7900a969
-  computing new diff
-  committed as 154b0179fb9b
-  working directory is now at 154b0179fb9b
+  recreate:[3] added n
+  atop:[1] added m and n
+  rebasing to destination parent: d3873e73d99e
+  committed as 89ba615ea1ec
+  working directory is now at 89ba615ea1ec
 
 XXX: this is messy, we should solve things in better way
-  $ hg glog -r 428f7900a969:: --hidden
-  @  31:154b0179fb9b phase-divergent update to 849cee0a874b:
+  $ hg glog --hidden
+  @  6:89ba615ea1ec phase-divergent update to a51bce62c219:
   |   () draft
-  | x  30:1ebf33547a82 added n
+  | x  5:ee4af146c5cf added n
   | |   () draft
-  +---o  29:870e1c3eddc3 phase-divergent update to 849cee0a874b:
+  +---o  4:86419909e017 phase-divergent update to a51bce62c219:
   | |     () draft
-  | | x  28:63ccb8ea7cae added n
+  | | x  3:e1154ec0206a added n
   | | |   () draft
-  | | x  27:f313e2b90e70 added m
+  | | x  2:4f25cd9cd2bf added m
   | |/    () draft
-  o |  26:849cee0a874b added m and n
+  o |  1:a51bce62c219 added m and n
   |/    () public
-  o  23:428f7900a969 added g
-  |   () public
-  ~
+  o  0:d3873e73d99e init
+      () public
+
+  $ hg obslog -r a51bce62c219 --all
+  o  86419909e017 (4) phase-divergent update to a51bce62c219:
+  |
+  | @  89ba615ea1ec (6) phase-divergent update to a51bce62c219:
+  | |
+  x |  4f25cd9cd2bf (2) added m
+  | |    rewritten(description, parent, content) as 86419909e017 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  ee4af146c5cf (5) added n
+  | |    rewritten(description, parent, content) as 89ba615ea1ec using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  e1154ec0206a (3) added n
+  |/     rewritten(parent) as ee4af146c5cf using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  o  a51bce62c219 (1) added m and n
+       rewritten(description, parent, content) as 4f25cd9cd2bf, e1154ec0206a using prune by test (Thu Jan 01 00:00:00 1970 +0000)
+  
 
 XXX: not sure this is the correct
-  $ hg exp 154b0179fb9b
+  $ hg exp 89ba615ea1ec
   # HG changeset patch
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID 154b0179fb9b53d2f853d6ba04740bb3d7a5cabe
-  # Parent  849cee0a874be7c4e75dfacb5ad72aa5696951ba
-  phase-divergent update to 849cee0a874b:
+  # Node ID 89ba615ea1ec3ba5b25db9f7897eb29712d7e5d6
+  # Parent  a51bce62c219f024bc0ae0cc0e3957ee77d7cb46
+  phase-divergent update to a51bce62c219:
   
   added n
   
-  diff -r 849cee0a874b -r 154b0179fb9b m
+  diff -r a51bce62c219 -r 89ba615ea1ec 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
 
 XXX: not sure this is correct
-  $ hg exp 870e1c3eddc3
+  $ hg exp 86419909e017
   # HG changeset patch
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID 870e1c3eddc34cc475e8e13d2fe1934210c1937e
-  # Parent  849cee0a874be7c4e75dfacb5ad72aa5696951ba
-  phase-divergent update to 849cee0a874b:
+  # Node ID 86419909e01787959aa6471aee605c6d604a3e0d
+  # Parent  a51bce62c219f024bc0ae0cc0e3957ee77d7cb46
+  phase-divergent update to a51bce62c219:
   
   added m
   
-  diff -r 849cee0a874b -r 870e1c3eddc3 n
+  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
 
-When the public changeset is splitted across various branches
---------------------------------------------------------------
+When the public changeset is split across various topological branches
+======================================================================
+
+  $ cd ../split-across-branches
 
   $ echo p > p
   $ echo q > q
@@ -1061,177 +1086,870 @@
 
   $ hg prev
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  [31] phase-divergent update to 849cee0a874b:
+  [0] init
   $ echo p > p
   $ hg ci -Aqm "added p"
   $ hg prev
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  [31] phase-divergent update to 849cee0a874b:
+  [0] init
   $ echo q > q
   $ hg ci -Aqm "added q"
 
-  $ hg glog -r 154b0179fb9b::
-  @  34:e046341aa97c added q
+  $ hg glog
+  @  3:bb87595f9a77 added q
   |   () draft
-  | o  33:6f8c250eecff added p
+  | o  2:a47263294745 added p
   |/    () draft
-  | o  32:8a70f55b2af3 added p and q
+  | o  1:90859808ece6 added p and q
   |/    () draft
-  o  31:154b0179fb9b phase-divergent update to 849cee0a874b:
-  |   () draft
-  ~
+  o  0:d3873e73d99e init
+      () public
 
-  $ hg prune -r 8a70f55b2af3 --succ 6f8c250eecff --succ e046341aa97c --split
+  $ hg prune -r 90859808ece6 --succ a47263294745 --succ bb87595f9a77 --split
   1 changesets pruned
 
-  $ hg phase -r 8a70f55b2af3 --public --hidden
+  $ hg phase -r 90859808ece6 --public --hidden
   2 new phase-divergent changesets
 
-  $ hg glog -r 154b0179fb9b::
-  @  34:e046341aa97c added q
+  $ hg glog
+  @  3:bb87595f9a77 added q
   |   () draft
-  | *  33:6f8c250eecff added p
+  | *  2:a47263294745 added p
   |/    () draft
-  | o  32:8a70f55b2af3 added p and q
+  | o  1:90859808ece6 added p and q
   |/    () public
-  o  31:154b0179fb9b phase-divergent update to 849cee0a874b:
-  |   () public
-  ~
+  o  0:d3873e73d99e init
+      () public
 
   $ hg evolve --list
-  6f8c250eecff: added p
-    phase-divergent: 8a70f55b2af3 (immutable precursor)
+  a47263294745: added p
+    phase-divergent: 90859808ece6 (immutable precursor)
   
-  e046341aa97c: added q
-    phase-divergent: 8a70f55b2af3 (immutable precursor)
+  bb87595f9a77: added q
+    phase-divergent: 90859808ece6 (immutable precursor)
   
   $ hg evolve --all --phase-divergent
-  recreate:[33] added p
-  atop:[32] added p and q
-  computing new diff
-  committed as f3e41d89b3c5
-  recreate:[34] added q
-  atop:[32] added p and q
-  computing new diff
-  committed as 605c306d4f87
-  working directory is now at 605c306d4f87
+  recreate:[2] added p
+  atop:[1] added p and q
+  committed as 25875a9cb640
+  recreate:[3] added q
+  atop:[1] added p and q
+  committed as 26f564f94bcc
+  working directory is now at 26f564f94bcc
 
-  $ hg glog -r 154b0179fb9b:: --hidden
-  @  36:605c306d4f87 phase-divergent update to 8a70f55b2af3:
+  $ hg glog --hidden
+  @  5:26f564f94bcc phase-divergent update to 90859808ece6:
   |   () draft
-  | o  35:f3e41d89b3c5 phase-divergent update to 8a70f55b2af3:
+  | o  4:25875a9cb640 phase-divergent update to 90859808ece6:
   |/    () draft
-  | x  34:e046341aa97c added q
+  | x  3:bb87595f9a77 added q
   | |   () draft
-  | | x  33:6f8c250eecff added p
+  | | x  2:a47263294745 added p
   | |/    () draft
-  o |  32:8a70f55b2af3 added p and q
+  o |  1:90859808ece6 added p and q
   |/    () public
-  o  31:154b0179fb9b phase-divergent update to 849cee0a874b:
-  |   () public
-  ~
+  o  0:d3873e73d99e init
+      () public
+
+  $ hg obslog -r 90859808ece6 --all
+  o  25875a9cb640 (4) phase-divergent update to 90859808ece6:
+  |
+  | @  26f564f94bcc (5) phase-divergent update to 90859808ece6:
+  | |
+  x |  a47263294745 (2) added p
+  | |    rewritten(description, parent, content) as 25875a9cb640 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  bb87595f9a77 (3) added q
+  |/     rewritten(description, parent, content) as 26f564f94bcc using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  o  90859808ece6 (1) added p and q
+       rewritten(description, content) as a47263294745, bb87595f9a77 using prune by test (Thu Jan 01 00:00:00 1970 +0000)
+  
 
 XXX: not sure this is correct
-  $ hg exp 605c306d4f87
+  $ hg exp 26f564f94bcc
   # HG changeset patch
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID 605c306d4f87fccfdb5e7dd1c750b6d4f813defb
-  # Parent  8a70f55b2af35452916dc89401a5ecf6553646a5
-  phase-divergent update to 8a70f55b2af3:
+  # Node ID 26f564f94bcc34e049eb112fd14ab1e5286f2325
+  # Parent  90859808ece64c9ca64dd29992db42353c70f164
+  phase-divergent update to 90859808ece6:
   
   added q
   
-  diff -r 8a70f55b2af3 -r 605c306d4f87 p
+  diff -r 90859808ece6 -r 26f564f94bcc p
   --- a/p	Thu Jan 01 00:00:00 1970 +0000
   +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   @@ -1,1 +0,0 @@
   -p
 
 XXX: not sure this is correct
-  $ hg exp f3e41d89b3c5
+  $ hg exp 25875a9cb640
   # HG changeset patch
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID f3e41d89b3c5f6ee49ccc734045856d7b025f048
-  # Parent  8a70f55b2af35452916dc89401a5ecf6553646a5
-  phase-divergent update to 8a70f55b2af3:
+  # Node ID 25875a9cb6400973b846c94f6a80410067c2cb1f
+  # Parent  90859808ece64c9ca64dd29992db42353c70f164
+  phase-divergent update to 90859808ece6:
   
   added p
   
-  diff -r 8a70f55b2af3 -r f3e41d89b3c5 q
+  diff -r 90859808ece6 -r 25875a9cb640 q
   --- a/q	Thu Jan 01 00:00:00 1970 +0000
   +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   @@ -1,1 +0,0 @@
   -q
 
-Testing the evolution of a phase-divergent merge with no conflicts
-------------------------------------------------------------------
+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 glog -r 154b0179fb9b::
-  @  36:605c306d4f87 phase-divergent update to 8a70f55b2af3:
+  $ 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
-  | o  35:f3e41d89b3c5 phase-divergent update to 8a70f55b2af3:
-  |/    () draft
-  o  32:8a70f55b2af3 added p and q
-  |   () public
-  o  31:154b0179fb9b phase-divergent update to 849cee0a874b:
-  |   () public
-  ~
+  | 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
+
+  $ hg obslog -r a51bce62c219 --all
+  o  86419909e017 (5) phase-divergent update to a51bce62c219:
+  |
+  | @  88b0dae5369a (7) phase-divergent update to a51bce62c219:
+  | |
+  x |  4f25cd9cd2bf (2) added m
+  | |    rewritten(description, parent, content) as 86419909e017 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  98dad8812511 (6) added n
+  | |    rewritten(description, parent, content) as 88b0dae5369a using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  52ca78bb98c7 (4) added n
+  | |    rewritten(parent) as 98dad8812511 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  e1154ec0206a (3) added n
+  |/     rewritten(content) as 52ca78bb98c7 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  o  a51bce62c219 (1) added m and n
+       rewritten(description, parent, content) as 4f25cd9cd2bf, e1154ec0206a using prune by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+
+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
+==================================================================
+
+  $ cd ../merge-no-conflict
 
   $ echo h > h
   $ hg ci -Aqm "added h"
   $ hg prev
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  [36] phase-divergent update to 8a70f55b2af3:
+  [0] init
   $ echo i > i
   $ hg ci -Aqm "added i"
-  $ hg merge -r ef8c23f37b55
+  $ hg merge -r a53d182199c1
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ hg ci -m "merge h and i"
 
-  $ hg glog -r 605c306d4f87::
-  @    39:12ebe0d625d7 merge h and i
+  $ hg glog
+  @    3:205b2f5ecb7b merge h and i
   |\    () draft
-  | o  38:9bb561db4230 added i
+  | o  2:f0be5e638ecf added i
   | |   () draft
-  o |  37:ef8c23f37b55 added h
+  o |  1:a53d182199c1 added h
   |/    () draft
-  o  36:605c306d4f87 phase-divergent update to 8a70f55b2af3:
-  |   () draft
-  ~
+  o  0:d3873e73d99e init
+      () public
 
-  $ hg up ef8c23f37b55
+  $ hg up a53d182199c1
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ hg merge -r 9bb561db4230
+  $ hg merge -r f0be5e638ecf
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ hg ci -m "merge h and i successor"
   created new head
-  $ hg glog -r 605c306d4f87::
-  @    40:d2aeda868461 merge h and i successor
+  $ hg glog
+  @    4:8d4acf488ab5 merge h and i successor
   |\    () draft
-  +---o  39:12ebe0d625d7 merge h and i
+  +---o  3:205b2f5ecb7b merge h and i
   | |/    () draft
-  | o  38:9bb561db4230 added i
+  | o  2:f0be5e638ecf added i
   | |   () draft
-  o |  37:ef8c23f37b55 added h
+  o |  1:a53d182199c1 added h
   |/    () draft
-  o  36:605c306d4f87 phase-divergent update to 8a70f55b2af3:
-  |   () draft
-  ~
+  o  0:d3873e73d99e init
+      () public
 
-  $ hg prune -r 12ebe0d625d7 --succ .
+  $ hg prune -r 205b2f5ecb7b --succ .
   1 changesets pruned
 
-  $ hg phase 12ebe0d625d7 --hidden --public
+  $ hg phase 205b2f5ecb7b --hidden --public
   1 new phase-divergent changesets
 
 Resolution of phase-divergent merge commit using `hg evolve`
 
 XXX: we should handle phase-divergent merges
   $ hg evolve --phase-divergent
-  skipping d2aeda868461 : we do not handle merge yet
+  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 ..
+
+Phase divergence with file removal cancelation
+==============================================
+
+  $ hg init cancel-removal
+  $ cd cancel-removal
+  $ echo a > a
+  $ echo b > b
+  $ echo c > c
+  $ echo d > d
+  $ hg ci -Aqm initial
+
+Oops, we meant to delete just 'a', but we deleted 'b' and 'c' too
+
+  $ hg rm a b c
+  $ hg ci -m 'delete a'
+  $ hg revert -r .^ b
+  $ hg amend
+  $ hg glog --hidden --patch
+  @  2:0825dcee2670 delete a
+  |   () draftdiff -r 75d2b02c4a5c -r 0825dcee2670 a
+  |  --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,1 +0,0 @@
+  |  -a
+  |  diff -r 75d2b02c4a5c -r 0825dcee2670 c
+  |  --- a/c	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,1 +0,0 @@
+  |  -c
+  |
+  | x  1:dff6e52f5e41 delete a
+  |/    () draftdiff -r 75d2b02c4a5c -r dff6e52f5e41 a
+  |    --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  |    +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |    @@ -1,1 +0,0 @@
+  |    -a
+  |    diff -r 75d2b02c4a5c -r dff6e52f5e41 b
+  |    --- a/b	Thu Jan 01 00:00:00 1970 +0000
+  |    +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |    @@ -1,1 +0,0 @@
+  |    -b
+  |    diff -r 75d2b02c4a5c -r dff6e52f5e41 c
+  |    --- a/c	Thu Jan 01 00:00:00 1970 +0000
+  |    +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |    @@ -1,1 +0,0 @@
+  |    -c
+  |
+  o  0:75d2b02c4a5c initial
+      () draftdiff -r 000000000000 -r 75d2b02c4a5c a
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/a	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +a
+     diff -r 000000000000 -r 75d2b02c4a5c b
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +b
+     diff -r 000000000000 -r 75d2b02c4a5c c
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +c
+     diff -r 000000000000 -r 75d2b02c4a5c d
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/d	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +d
+  
+
+The public predecessors deletes'a', 'b' and 'c',
+If was amended to only delete 'a', and 'c'
+so the fixup should add back 'b'.
+
+  $ hg phase -p -r dff6e52f5e41 --hidden
+  1 new phase-divergent changesets
+  $ hg evolve --phase-divergent
+  recreate:[2] delete a
+  atop:[1] delete a
+  committed as 84aa492b3c37
+  working directory is now at 84aa492b3c37
+  $ hg glog --patch
+  @  3:84aa492b3c37 phase-divergent update to dff6e52f5e41:
+  |   () draftdiff -r dff6e52f5e41 -r 84aa492b3c37 b
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +b
+  |
+  o  1:dff6e52f5e41 delete a
+  |   () publicdiff -r 75d2b02c4a5c -r dff6e52f5e41 a
+  |  --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,1 +0,0 @@
+  |  -a
+  |  diff -r 75d2b02c4a5c -r dff6e52f5e41 b
+  |  --- a/b	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,1 +0,0 @@
+  |  -b
+  |  diff -r 75d2b02c4a5c -r dff6e52f5e41 c
+  |  --- a/c	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,1 +0,0 @@
+  |  -c
+  |
+  o  0:75d2b02c4a5c initial
+      () publicdiff -r 000000000000 -r 75d2b02c4a5c a
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/a	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +a
+     diff -r 000000000000 -r 75d2b02c4a5c b
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +b
+     diff -r 000000000000 -r 75d2b02c4a5c c
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +c
+     diff -r 000000000000 -r 75d2b02c4a5c d
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/d	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +d
+  
+
+  $ hg diff --change .
+  diff -r dff6e52f5e41 -r 84aa492b3c37 b
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +b
+