evolve: add test to show that user can create phase-divergence locally draft
authorSushil khanchi <sushilkhanchi97@gmail.com>
Sun, 10 Nov 2019 18:08:57 +0530
changeset 5232 edd40c8b3dc1
parent 5231 9d05eb69cd05
child 5233 efd1aa8c313c
evolve: add test to show that user can create phase-divergence locally After resolution of phase-divergence, user can locally create phase-divergence by rewriting the old bumped (obsolete now) changeset. Next patch will be adding the pre-check logic for creation of this phase-divergence.
tests/test-evolve-phase-divergence.t
--- a/tests/test-evolve-phase-divergence.t	Mon Nov 04 00:18:55 2019 +0530
+++ b/tests/test-evolve-phase-divergence.t	Sun Nov 10 18:08:57 2019 +0530
@@ -1955,4 +1955,81 @@
   +++ b/b	Thu Jan 01 00:00:00 1970 +0000
   @@ -0,0 +1,1 @@
   +b
+  $ cd ..
 
+Test of pre-checking the creation of phase divergence locally
+=============================================================
+What are we testing here is that: after we resolve a phase divergence (which
+occured when we pulled from public repo) if we revive that phase-divergent rev
+(obsolete now) it will create phase-divergence. So our pre-check logic is to
+catch that part.
+  $ hg init phasediv-public
+  $ cd phasediv-public
+  $ cat >> .hg/hgrc << EOF
+  > [phases]
+  > publish=False
+  > EOF
+
+  $ echo a > a
+  $ hg ci -Aqm "add a"
+  $ echo b > b
+  $ hg ci -Aqm "add b"
+  $ cd ..
+
+  $ hg clone phasediv-public phasediv-local
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd phasediv-local
+  $ hg up -r "desc('add b')"
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo bb >> b
+  $ hg amend
+
+Publish the revs at public side
+  $ cd ../phasediv-public
+  $ hg phase --public
+
+Pull into local from public repo
+  $ cd ../phasediv-local
+  $ hg pull
+  pulling from $TESTTMP/merge-no-conflict/phasediv-public
+  searching for changes
+  no changes found
+  1 new phase-divergent changesets
+  2 local changesets published
+
+  $ hg log -GT "{rev}:{node|short} {desc|firstline}\t {troubles}\n {phase}"
+  @  2:603041d63ba0 add b	 phase-divergent
+  |   draft
+  | o  1:7c3bad9141dc add b
+  |/    public
+  o  0:1f0dee641bb7 add a
+      public
+
+Evolve phase-divergence
+  $ hg evolve --phase-divergent
+  recreate:[2] add b
+  atop:[1] add b
+  committed as d2ee22650c7c
+  working directory is now at d2ee22650c7c
+
+Revive phase-divergent (obsolete) rev
+  $ hg log --hidden -GT "{rev}:{node|short} {desc|firstline}\t {troubles}\n {phase}"
+  @  3:d2ee22650c7c phase-divergent update to 7c3bad9141dc:
+  |   draft
+  | x  2:603041d63ba0 add b
+  | |   draft
+  o |  1:7c3bad9141dc add b
+  |/    public
+  o  0:1f0dee641bb7 add a
+      public
+First, let's prune the tip (cset which is result of resolution of phase-divergence)
+to avoid creating both content-div and phase-div at the same time while reviving
+phase-divergent cset.
+  $ hg prune .
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 7c3bad9141dc
+  1 changesets pruned
+
+  $ hg touch --hidden -r 2
+  1 new phase-divergent changesets