tests: add one more test case about handling of phase-divergence by evolve
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 23 Mar 2018 17:20:20 +0530
changeset 3621 db3ec5f79ab9
parent 3620 1f020455f6fe
child 3622 534af64b0107
tests: add one more test case about handling of phase-divergence by evolve This patch adds a test case when phasedivergence is caused by rebase command and there is parent change involved. As the tests show, we are not handling things correctly here. Upcoming patches will fix that. Fixing things in later patches showed there was a wrong case in one another test which will be fixed by later patches, so let's add description on why that test is wrong in this patch.
tests/test-evolve-phase-divergence.t
tests/test-stabilize-result.t
--- a/tests/test-evolve-phase-divergence.t	Fri Mar 23 15:27:26 2018 +0530
+++ b/tests/test-evolve-phase-divergence.t	Fri Mar 23 17:20:20 2018 +0530
@@ -4,6 +4,8 @@
   $ cat >> $HGRCPATH <<EOF
   > [alias]
   > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
+  > [extensions]
+  > rebase =
   > EOF
 
 Setting up a public repo
@@ -496,3 +498,167 @@
   |   () public
   o  0:d3873e73d99e init
       () public
+
+Syncing all the repositories
+----------------------------
+
+  $ hg push ../private
+  pushing to ../private
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  2 new obsolescence markers
+  $ hg push ../public
+  pushing to ../public
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  2 new obsolescence markers
+
+Creating phase-divergence with divergent changeset and precursor having
+different parents
+-----------------------------------------------------------------------
+
+Alice creates a changeset and pushes to private repo
+
+  $ echo x > x
+  $ hg ci -Am "added x to x"
+  adding x
+
+  $ hg push ../private
+  pushing to ../private
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+
+Bob does what he always does, pull from private and push to public, he is acting
+as a CI service
+
+  $ cd ../bob
+  $ hg pull ../private
+  pulling from ../private
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 2 files
+  2 new obsolescence markers
+  new changesets 502e73736632:2352021b3785
+  (run 'hg update' to get a working copy)
+  $ hg push ../public
+  pushing to ../public
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+
+Alice like always dont care about Bob existence and rebases her changeset and
+then pull from public repo creating phase divergence
+
+  $ cd ../alice
+  $ hg rebase -r . -d .^^^
+  rebasing 9:2352021b3785 "added x to x" (bm tip)
+
+  $ hg pull ../public
+  pulling from ../public
+  searching for changes
+  no changes found
+  1 new phase-divergent changesets
+
+  $ hg obslog -r .
+  @  334e300d6db5 (10) added x to x
+  |
+  o  2352021b3785 (9) added x to x
+       rewritten(parent) as 334e300d6db5 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+  $ hg glog -r .^::
+  @  10:334e300d6db5 added x to x
+  |   (bm) draft
+  | o  9:2352021b3785 added x to x
+  | |   () public
+  | o  8:502e73736632 phase-divergent update to b756eb10ea73:
+  | |
+  | |  foo to bar
+  | |   () public
+  | o  6:b756eb10ea73 added bar to bar
+  |/    () public
+  o  5:3d62500c673d phase-divergent update to aa071e5554e3:
+  |
+  ~  added bar to foo
+      () public
+
+Using `hg evolve` to resolve phase-divergence
+---------------------------------------------
+
+  $ hg evolve --phase-divergent
+  recreate:[10] added x to x
+  atop:[9] added x to x
+  rebasing to destination parent: 502e73736632
+  (leaving bookmark bm)
+  computing new diff
+  committed as 5388376cb2f0
+  working directory is now at 5388376cb2f0
+
+XXX: we should not have created a new commit here
+  $ hg glog
+  @  12:5388376cb2f0 phase-divergent update to 2352021b3785:
+  |
+  |  added x to x
+  |   () draft
+  | x  11:b1a0e143e32b added x to x
+  | |   (bm) draft
+  o |  9:2352021b3785 added x to x
+  |/    () public
+  o  8:502e73736632 phase-divergent update to b756eb10ea73:
+  |
+  |  foo to bar
+  |   () public
+  o  6:b756eb10ea73 added bar to bar
+  |   () public
+  o  5:3d62500c673d phase-divergent update to aa071e5554e3:
+  |
+  |  added bar to foo
+  |   () public
+  o  3:aa071e5554e3 added foo to foo
+  |   () public
+  o  1:4d1169d82e47 modify a
+  |   () public
+  o  0:d3873e73d99e init
+      () public
+
+  $ hg obslog -r .
+  @  5388376cb2f0 (12) phase-divergent update to 2352021b3785:
+  |
+  x  b1a0e143e32b (11) added x to x
+  |    rewritten(description, parent, content) as 5388376cb2f0 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  x  334e300d6db5 (10) added x to x
+  |    rewritten(parent) as b1a0e143e32b using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  o  2352021b3785 (9) added x to x
+       rewritten(parent) as 334e300d6db5 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+XXX: The existence of this changeset is wrong, moreover its diff is wrong
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 5388376cb2f0f9bc4842361fb16fe66ce5cc2f6d
+  # Parent  2352021b37851be226ebed109b0eb6eada918566
+  phase-divergent update to 2352021b3785:
+  
+  added x to x
+  
+  diff -r 2352021b3785 -r 5388376cb2f0 bar
+  --- a/bar	Thu Jan 01 00:00:00 1970 +0000
+  +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +0,0 @@
+  -foo
--- a/tests/test-stabilize-result.t	Fri Mar 23 15:27:26 2018 +0530
+++ b/tests/test-stabilize-result.t	Fri Mar 23 17:20:20 2018 +0530
@@ -186,6 +186,31 @@
   |
   o  0:07f494440405@default(public) bk:[] adda
   
+XXX: c addition should not be part of this patch
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 3d968e0b3097ef69b104ff2e1af43fce665feb0a
+  # Parent  1cf0aacfd36310b18e403e1594871187e0364a82
+  phase-divergent update to 1cf0aacfd363:
+  
+  newer a
+  
+  diff -r 1cf0aacfd363 -r 3d968e0b3097 a
+  --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,3 +1,4 @@
+   a
+   a
+   newer a
+  +babar
+  diff -r 1cf0aacfd363 -r 3d968e0b3097 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
 
 Stabilize divergent changesets with same parent
 ===============================================