tests: add tests of content+parent change creating phase-divergence
This patch adds tests which shows handling of phase divergence cases by `hg
evolve` command which involved content+parent change. The conflicts case is not
handled and will be fixed in upcoming patches.
--- a/tests/test-evolve-phase-divergence.t Fri Mar 23 18:28:37 2018 +0530
+++ b/tests/test-evolve-phase-divergence.t Fri Mar 23 18:58:19 2018 +0530
@@ -637,3 +637,185 @@
+++ b/x Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,1 @@
+x
+
+Creating divergence with parent and content change both but not resulting in
+conflicts
+-----------------------------------------------------------------------------
+
+Alice is tired of pushing and pulling and will create phase-divergence locally
+
+ $ hg glog
+ @ 9:2352021b3785 added x to x
+ | (bm) public
+ o 8:502e73736632 phase-divergent update to b756eb10ea73:
+ | () public
+ o 6:b756eb10ea73 added bar to bar
+ | () public
+ o 5:3d62500c673d phase-divergent update to aa071e5554e3:
+ | () public
+ o 3:aa071e5554e3 added foo to foo
+ | () public
+ o 1:4d1169d82e47 modify a
+ | () public
+ o 0:d3873e73d99e init
+ () public
+
+ $ echo y > y
+ $ echo foobar >> foo
+ $ hg add y
+ $ hg ci -m "y to y and foobar to foo"
+ $ hg rebase -r . -d .^^^
+ rebasing 12:dc88f5aa9bc9 "y to y and foobar to foo" (tip)
+
+ $ echo foo > y
+ $ hg amend
+
+Alice making the old changeset public to have content-divergence
+
+ $ hg phase -r dc88f5aa9bc9 --public --hidden
+ 1 new phase-divergent changesets
+ $ hg glog
+ @ 14:13015a180eee y to y and foobar to foo
+ | () draft
+ | o 12:dc88f5aa9bc9 y to y and foobar to foo
+ | | () public
+ | o 9:2352021b3785 added x to x
+ | | (bm) public
+ | o 8:502e73736632 phase-divergent update to b756eb10ea73:
+ |/ () public
+ o 6:b756eb10ea73 added bar to bar
+ | () public
+ o 5:3d62500c673d phase-divergent update to aa071e5554e3:
+ | () public
+ o 3:aa071e5554e3 added foo to foo
+ | () public
+ o 1:4d1169d82e47 modify a
+ | () public
+ o 0:d3873e73d99e init
+ () public
+
+ $ hg obslog -r .
+ @ 13015a180eee (14) y to y and foobar to foo
+ |
+ x 211ab84d1689 (13) y to y and foobar to foo
+ | rewritten(content) as 13015a180eee using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+ |
+ o dc88f5aa9bc9 (12) y to y and foobar to foo
+ rewritten(parent) as 211ab84d1689 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
+
+Resolving divergence using `hg evolve`
+-------------------------------------
+
+ $ hg evolve --phase-divergent
+ 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
+
+ $ hg exp
+ # HG changeset patch
+ # User test
+ # Date 0 0
+ # Thu Jan 01 00:00:00 1970 +0000
+ # Node ID 8c2bb6fb44e9443c64b3a2a3d061272c8e25e6ce
+ # Parent dc88f5aa9bc90a6418899d267d9524205dfb429b
+ phase-divergent update to dc88f5aa9bc9:
+
+ y to y and foobar to foo
+
+ diff -r dc88f5aa9bc9 -r 8c2bb6fb44e9 y
+ --- a/y Thu Jan 01 00:00:00 1970 +0000
+ +++ b/y Thu Jan 01 00:00:00 1970 +0000
+ @@ -1,1 +1,1 @@
+ -y
+ +foo
+
+ $ hg glog
+ @ 16:8c2bb6fb44e9 phase-divergent update to dc88f5aa9bc9:
+ | () draft
+ o 12:dc88f5aa9bc9 y to y and foobar to foo
+ | () public
+ o 9:2352021b3785 added x to x
+ | (bm) public
+ o 8:502e73736632 phase-divergent update to b756eb10ea73:
+ | () public
+ o 6:b756eb10ea73 added bar to bar
+ | () public
+ o 5:3d62500c673d phase-divergent update to aa071e5554e3:
+ | () public
+ o 3:aa071e5554e3 added foo to foo
+ | () public
+ o 1:4d1169d82e47 modify a
+ | () public
+ o 0:d3873e73d99e init
+ () public
+
+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"
+ $ hg rebase -r . -d .^^^^
+ rebasing 17:f3794e5a91dc "added l to l" (tip)
+ $ echo kl > l
+ $ echo foo > x
+ $ hg add x
+ $ hg amend
+
+ $ hg obslog -r .
+ @ 5fd38c0de46e (19) added l to l
+ |
+ x 2bfd56949cf0 (18) added l to l
+ | rewritten(content) as 5fd38c0de46e using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+ |
+ x f3794e5a91dc (17) added l to l
+ rewritten(parent) as 2bfd56949cf0 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
+
+
+ $ hg phase -r f3794e5a91dc --public --hidden
+ 1 new phase-divergent changesets
+
+Resolution using `hg evolve --phase-divergent`
+----------------------------------------------
+
+ $ hg evolve --phase-divergent
+ recreate:[19] added l to l
+ atop:[17] added l to l
+ rebasing to destination parent: 8c2bb6fb44e9
+ merging x
+ warning: conflicts while merging x! (edit, then use 'hg resolve --mark')
+ evolution failed!
+ fix conflict and run 'hg evolve --continue'
+ abort: unresolved merge conflicts (see hg help resolve)
+ [255]
+
+ $ hg diff
+ diff -r 8c2bb6fb44e9 l
+ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+ +++ b/l Thu Jan 01 00:00:00 1970 +0000
+ @@ -0,0 +1,1 @@
+ +kl
+ diff -r 8c2bb6fb44e9 x
+ --- a/x Thu Jan 01 00:00:00 1970 +0000
+ +++ b/x Thu Jan 01 00:00:00 1970 +0000
+ @@ -1,1 +1,5 @@
+ +<<<<<<< destination: 8c2bb6fb44e9 - test: phase-divergent update to dc88f5aa9...
+ x
+ +=======
+ +foo
+ +>>>>>>> evolving: 5fd38c0de46e - test: added l to l
+
+ $ echo foo > x
+
+XXX: we should suggest graft --continue here
+ $ hg resolve -m
+ (no more unresolved files)
+ continue: hg graft --continue
+
+XXX: we should handle this correctly here
+ $ hg evolve --continue
+ abort: no interrupted evolve to continue
+ [255]