changeset 3634:a9fed41c6bed

tests: add more tests for solving phase-divergence using `hg evolve` This patch adds more tests for resolving phase-divergence caused due to fold or split using `hg evolve` command. The resolution in case of split is not very good and will be fixed in upcoming patches
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 28 Mar 2018 12:56:35 +0530
parents ed3032ee53eb
children debd2f974be5
files tests/test-evolve-phase-divergence.t
diffstat 1 files changed, 294 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-evolve-phase-divergence.t	Sat Mar 24 17:21:42 2018 +0530
+++ b/tests/test-evolve-phase-divergence.t	Wed Mar 28 12:56:35 2018 +0530
@@ -867,3 +867,297 @@
   @@ -1,1 +1,1 @@
   -x
   +foo
+
+Creating phase divergence when couple of changesets are folded into one
+------------------------------------------------------------------------
+
+  $ hg glog -r .
+  @  21:e3090241a10c phase-divergent update to f3794e5a91dc:
+  |   () draft
+  ~
+  $ echo f > f
+  $ hg ci -Aqm "added f"
+  $ echo g > g
+  $ hg ci -Aqm "added g"
+
+  $ hg fold -r . -r .^ --exact
+  2 changesets folded
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg evolve --list
+
+  $ hg phase -r 428f7900a969 --public --hidden
+  1 new phase-divergent changesets
+
+  $ hg glog -r f3794e5a91dc::
+  @  24:e450d05b7d27 added g
+  |   () draft
+  | o  23:428f7900a969 added g
+  | |   () public
+  | o  22:21ae52e414e6 added f
+  |/    () public
+  o  21:e3090241a10c phase-divergent update to f3794e5a91dc:
+  |   () public
+  o  17:f3794e5a91dc added l to l
+  |   () public
+  ~
+
+  $ hg evolve --list
+  e450d05b7d27: added g
+    phase-divergent: 21ae52e414e6 (immutable precursor)
+    phase-divergent: 428f7900a969 (immutable precursor)
+  
+Resolving phase divergence using `hg evolve`
+
+  $ hg evolve --phase-divergent --all
+  recreate:[24] added g
+  atop:[23] added g
+  rebasing to destination parent: 21ae52e414e6
+  computing new diff
+  committed as 428f7900a969
+  working directory is now at 428f7900a969
+
+  $ hg glog -r f3794e5a91dc::
+  @  23:428f7900a969 added g
+  |   () public
+  o  22:21ae52e414e6 added f
+  |   () public
+  o  21:e3090241a10c phase-divergent update to f3794e5a91dc:
+  |   () public
+  o  17:f3794e5a91dc added l to l
+  |   () public
+  ~
+
+When the public changesets is splitted causing phase-divergence
+---------------------------------------------------------------
+
+  $ echo m > m
+  $ echo n > n
+  $ hg ci -Aqm "added m and n"
+
+  $ hg glog -r 21ae52e414e6::
+  @  26:849cee0a874b added m and n
+  |   () draft
+  o  23:428f7900a969 added g
+  |   () public
+  o  22:21ae52e414e6 added f
+  |   () public
+  ~
+
+  $ hg prev
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  [23] added g
+  $ echo m > m
+  $ hg ci -Aqm "added m"
+  $ echo n > n
+  $ hg ci -Aqm "added n"
+
+  $ hg glog -r 428f7900a969::
+  @  28:63ccb8ea7cae added n
+  |   () draft
+  o  27:f313e2b90e70 added m
+  |   () draft
+  | o  26:849cee0a874b added m and n
+  |/    () draft
+  o  23:428f7900a969 added g
+  |   () public
+  ~
+
+  $ hg prune -r 849cee0a874b --succ f313e2b90e70 --succ 63ccb8ea7cae --split
+  1 changesets pruned
+
+  $ hg phase -r 849cee0a874b --hidden --public
+  2 new phase-divergent changesets
+
+  $ hg glog -r 428f7900a969::
+  @  28:63ccb8ea7cae added n
+  |   () draft
+  *  27:f313e2b90e70 added m
+  |   () draft
+  | o  26:849cee0a874b added m and n
+  |/    () public
+  o  23:428f7900a969 added g
+  |   () public
+  ~
+
+  $ hg evolve --all --phase-divergent
+  recreate:[27] added m
+  atop:[26] added m and n
+  computing new diff
+  committed as 870e1c3eddc3
+  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
+
+XXX: this is messy, we should solve things in better way
+  $ hg glog -r 428f7900a969:: --hidden
+  @  31:154b0179fb9b phase-divergent update to 849cee0a874b:
+  |   () draft
+  | x  30:1ebf33547a82 added n
+  | |   () draft
+  +---o  29:870e1c3eddc3 phase-divergent update to 849cee0a874b:
+  | |     () draft
+  | | x  28:63ccb8ea7cae added n
+  | | |   () draft
+  | | x  27:f313e2b90e70 added m
+  | |/    () draft
+  o |  26:849cee0a874b added m and n
+  |/    () public
+  o  23:428f7900a969 added g
+  |   () public
+  ~
+
+XXX: not sure this is the correct
+  $ hg exp 154b0179fb9b
+  # 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:
+  
+  added n
+  
+  diff -r 849cee0a874b -r 154b0179fb9b 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 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:
+  
+  added m
+  
+  diff -r 849cee0a874b -r 870e1c3eddc3 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
+--------------------------------------------------------------
+
+  $ echo p > p
+  $ echo q > q
+  $ hg ci -Aqm "added p and q"
+
+  $ hg prev
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  [31] phase-divergent update to 849cee0a874b:
+  $ 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:
+  $ echo q > q
+  $ hg ci -Aqm "added q"
+
+  $ hg glog -r 154b0179fb9b::
+  @  34:e046341aa97c added q
+  |   () draft
+  | o  33:6f8c250eecff added p
+  |/    () draft
+  | o  32:8a70f55b2af3 added p and q
+  |/    () draft
+  o  31:154b0179fb9b phase-divergent update to 849cee0a874b:
+  |   () draft
+  ~
+
+  $ hg prune -r 8a70f55b2af3 --succ 6f8c250eecff --succ e046341aa97c --split
+  1 changesets pruned
+
+  $ hg phase -r 8a70f55b2af3 --public --hidden
+  2 new phase-divergent changesets
+
+  $ hg glog -r 154b0179fb9b::
+  @  34:e046341aa97c added q
+  |   () draft
+  | *  33:6f8c250eecff added p
+  |/    () draft
+  | o  32:8a70f55b2af3 added p and q
+  |/    () public
+  o  31:154b0179fb9b phase-divergent update to 849cee0a874b:
+  |   () public
+  ~
+
+  $ hg evolve --list
+  6f8c250eecff: added p
+    phase-divergent: 8a70f55b2af3 (immutable precursor)
+  
+  e046341aa97c: added q
+    phase-divergent: 8a70f55b2af3 (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
+
+  $ hg glog -r 154b0179fb9b:: --hidden
+  @  36:605c306d4f87 phase-divergent update to 8a70f55b2af3:
+  |   () draft
+  | o  35:f3e41d89b3c5 phase-divergent update to 8a70f55b2af3:
+  |/    () draft
+  | x  34:e046341aa97c added q
+  | |   () draft
+  | | x  33:6f8c250eecff added p
+  | |/    () draft
+  o |  32:8a70f55b2af3 added p and q
+  |/    () public
+  o  31:154b0179fb9b phase-divergent update to 849cee0a874b:
+  |   () public
+  ~
+
+XXX: not sure this is correct
+  $ hg exp 605c306d4f87
+  # 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:
+  
+  added q
+  
+  diff -r 8a70f55b2af3 -r 605c306d4f87 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 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:
+  
+  added p
+  
+  diff -r 8a70f55b2af3 -r f3e41d89b3c5 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