evolve: add test for the case where public divergence on difference parents
This test make sure that public divergence resolution also handle the case when
divergentes changeset does not share the same parent at one end because one end
simply rebase. The other side has actual an actual diff change.
For now this would work only for the case when we need to relocate
the mutable one. Other case is still left to work on.
--- a/tests/test-evolve-public-content-divergent.t Mon Jan 21 23:06:10 2019 +0530
+++ b/tests/test-evolve-public-content-divergent.t Tue Jan 22 18:40:10 2019 +0530
@@ -189,3 +189,177 @@
o 0:9092f1db7931 added a
public
+Testing the case when divergence is not created by actual diff change, but because of rebasing:
+------------------------------------------------------------------------------------------------
+
+Prepare the repo:
+
+ $ cd ..
+ $ hg init rebasediv
+ $ cd rebasediv
+ $ for ch in a b c; do
+ > echo $ch > $ch;
+ > hg ci -Am "added "$ch;
+ > done;
+ adding a
+ adding b
+ adding c
+
+ $ hg glog
+ @ 2:155349b645be added c
+ | draft
+ |
+ o 1:5f6d8a4bf34a added b
+ | draft
+ |
+ o 0:9092f1db7931 added a
+ draft
+
+
+On server side: a new cset is added based on rev 1 and rev 2 is rebased on newly added cset:
+
+ $ hg up .^ -q
+ $ echo d > d
+ $ hg ci -Am "added d"
+ adding d
+ created new head
+
+ $ hg rebase -r 2 -d .
+ rebasing 2:155349b645be "added c"
+
+ $ hg glog
+ o 4:c0d7ee6604ea added c
+ | draft
+ |
+ @ 3:c9241b0f2d5b added d
+ | draft
+ |
+ o 1:5f6d8a4bf34a added b
+ | draft
+ |
+ o 0:9092f1db7931 added a
+ draft
+
+
+On user side: user has not pulled yet and amended the rev 2 which created the divergence after pull:
+ $ hg up 2 --hidden -q
+ updated to hidden changeset 155349b645be
+ (hidden revision '155349b645be' was rewritten as: c0d7ee6604ea)
+ working directory parent is obsolete! (155349b645be)
+
+ $ echo cc >> c
+ $ hg ci --amend -m "updated c"
+ 2 new content-divergent changesets
+
+Lets change the phase to --public of branch which is pulled from server:
+ $ hg phase --public -r 4
+ $ hg glog -p
+ @ 5:f5f9b4fc8b77 updated c
+ | draft content-divergent
+ |
+ | diff -r 5f6d8a4bf34a -r f5f9b4fc8b77 c
+ | --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+ | +++ b/c Thu Jan 01 00:00:00 1970 +0000
+ | @@ -0,0 +1,2 @@
+ | +c
+ | +cc
+ |
+ | o 4:c0d7ee6604ea added c
+ | | public
+ | |
+ | | diff -r c9241b0f2d5b -r c0d7ee6604ea 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
+ | |
+ | o 3:c9241b0f2d5b added d
+ |/ public
+ |
+ | diff -r 5f6d8a4bf34a -r c9241b0f2d5b 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
+ |
+ o 1:5f6d8a4bf34a added b
+ | public
+ |
+ | diff -r 9092f1db7931 -r 5f6d8a4bf34a 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 0:9092f1db7931 added a
+ public
+
+ diff -r 000000000000 -r 9092f1db7931 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
+
+
+Evolve:
+ $ hg evolve --content-divergent
+ merge:[4] added c
+ with: [5] updated c
+ base: [2] added c
+ rebasing "other" content-divergent changeset f5f9b4fc8b77 on c9241b0f2d5b
+ updating to "local" side of the conflict: c0d7ee6604ea
+ merging "other" content-divergent changeset 'c3d442d80993'
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ computing new diff
+ committed as 3b336cbee992
+ working directory is now at 3b336cbee992
+
+ $ hg glog -p
+ @ 8:3b336cbee992 phase-divergent update to c0d7ee6604ea:
+ | draft
+ |
+ | diff -r c0d7ee6604ea -r 3b336cbee992 c
+ | --- a/c Thu Jan 01 00:00:00 1970 +0000
+ | +++ b/c Thu Jan 01 00:00:00 1970 +0000
+ | @@ -1,1 +1,2 @@
+ | c
+ | +cc
+ |
+ o 4:c0d7ee6604ea added c
+ | public
+ |
+ | diff -r c9241b0f2d5b -r c0d7ee6604ea 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
+ |
+ o 3:c9241b0f2d5b added d
+ | public
+ |
+ | diff -r 5f6d8a4bf34a -r c9241b0f2d5b 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
+ |
+ o 1:5f6d8a4bf34a added b
+ | public
+ |
+ | diff -r 9092f1db7931 -r 5f6d8a4bf34a 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 0:9092f1db7931 added a
+ public
+
+ diff -r 000000000000 -r 9092f1db7931 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
+
+Check that we don't have any troubled cset now:
+ $ hg evolve -l