changeset 3620:1f020455f6fe

tests: add more tests for handling of phase divergence by `hg evolve` This patch adds more tests related to handling of phase-divergence by `hg evolve` command.
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 23 Mar 2018 15:27:26 +0530
parents 914d3cf8d392
children db3ec5f79ab9
files tests/test-evolve-phase-divergence.t
diffstat 1 files changed, 297 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-evolve-phase-divergence.t	Fri Mar 23 13:16:42 2018 +0530
+++ b/tests/test-evolve-phase-divergence.t	Fri Mar 23 15:27:26 2018 +0530
@@ -199,3 +199,300 @@
   |   () public
   o  0:d3873e73d99e init
       () public
+
+Syncying every repo with the new state
+--------------------------------------
+
+  $ hg push ../public
+  pushing to ../public
+  searching for changes
+  no changes found
+  2 new obsolescence markers
+  [1]
+  $ hg push ../private
+  pushing to ../private
+  searching for changes
+  no changes found
+  2 new obsolescence markers
+  [1]
+  $ hg push ../bob
+  pushing to ../bob
+  searching for changes
+  no changes found
+  2 new obsolescence markers
+  [1]
+
+Creating more phase-divergence where a new resolution commit will be formed and
+also testing bookmark movement
+--------------------------------------------------------------------------------
+
+Alice created a commit and push to private non-publishing repo
+
+  $ echo foo > foo
+  $ hg add foo
+  $ hg ci -m "added foo to foo"
+  $ hg glog
+  @  3:aa071e5554e3 added foo to foo
+  |   () draft
+  o  1:4d1169d82e47 modify a
+  |   () public
+  o  0:d3873e73d99e init
+      () public
+
+  $ 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 pulled from the private repo and pushed that to publishing repo
+
+  $ cd ../bob
+  $ hg pull ../private
+  pulling from ../private
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  new changesets aa071e5554e3
+  (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 amended that changeset and then pulled from publishing repo creating
+phase-divergence
+
+  $ cd ../alice
+  $ echo bar >> foo
+  $ hg amend -m "added bar to foo"
+  $ hg bookmark bm
+
+  $ hg pull ../public
+  pulling from ../public
+  searching for changes
+  no changes found
+  1 new phase-divergent changesets
+
+  $ hg glog
+  @  4:d47f2b37ed82 added bar to foo
+  |   (bm) draft
+  | o  3:aa071e5554e3 added foo to foo
+  |/    () public
+  o  1:4d1169d82e47 modify a
+  |   () public
+  o  0:d3873e73d99e init
+      () public
+
+Resolving the new phase-divergence changeset using `hg evolve`
+--------------------------------------------------------------
+
+XXX: this should have popped up for a new commit message of the changeset or an
+option should be there
+
+XXX: we should document what should user expect where running this, writing this
+test I have to go through code base to understand what will be the behavior
+
+  $ hg evolve --phase-divergent
+  recreate:[4] added bar to foo
+  atop:[3] added foo to foo
+  computing new diff
+  committed as 3d62500c673d
+  working directory is now at 3d62500c673d
+
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 3d62500c673dd1c88bb09a73e86d0210aed6fcb6
+  # Parent  aa071e5554e36080a36cfd24accd5a71e3320f1e
+  phase-divergent update to aa071e5554e3:
+  
+  added bar to foo
+  
+  diff -r aa071e5554e3 -r 3d62500c673d foo
+  --- a/foo	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/foo	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,2 @@
+   foo
+  +bar
+
+XXX: the commit message is not best one, we should give option to user to modify
+the commit message
+
+  $ hg glog
+  @  5:3d62500c673d phase-divergent update to aa071e5554e3:
+  |
+  |  added bar to foo
+  |   (bm) draft
+  o  3:aa071e5554e3 added foo to foo
+  |   () public
+  o  1:4d1169d82e47 modify a
+  |   () public
+  o  0:d3873e73d99e init
+      () public
+
+  $ hg obslog -r . --all
+  @  3d62500c673d (5) phase-divergent update to aa071e5554e3:
+  |
+  x  d47f2b37ed82 (4) added bar to foo
+  |    rewritten(description, parent, content) as 3d62500c673d using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  o  aa071e5554e3 (3) added foo to foo
+       rewritten(description, content) as d47f2b37ed82 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+
+Syncing all other repositories
+------------------------------
+
+These pushed should not be turned to quiet mode as the output is very helpful to
+make sure everything is working fine
+
+  $ hg push ../bob
+  pushing to ../bob
+  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 ../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 a phasedivergence changeset where the divergent changeset changed in a
+way that we rebase that on old public changeset, there will be conflicts, but
+the `hg evolve` command handles it very well and uses `hg revert` logic to
+prevent any conflicts
+-------------------------------------------------------------------------------
+
+Alice creates one more changeset and pushes to private repo
+
+  $ echo bar > bar
+  $ hg ci -Aqm "added bar to bar"
+  $ 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 pulls from private and pushes to public repo
+  $ cd ../bob
+
+  $ hg pull ../private
+  pulling from ../private
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  new changesets b756eb10ea73
+  (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 amends the changeset and then pull from public creating phase-divergence
+
+  $ cd ../alice
+  $ echo foo > bar
+  $ hg amend -m "foo to bar"
+
+  $ hg pull ../public
+  pulling from ../public
+  searching for changes
+  no changes found
+  1 new phase-divergent changesets
+
+  $ hg glog
+  @  7:2c3560aedead foo to bar
+  |   (bm) draft
+  | 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
+
+Resolving the new phase-divergence changeset using `hg evolve`
+---------------------------------------------------------------
+
+  $ hg evolve --phase-divergent
+  recreate:[7] foo to bar
+  atop:[6] added bar to bar
+  computing new diff
+  committed as 502e73736632
+  working directory is now at 502e73736632
+
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 502e737366322886cf628276aa0a2796904453b4
+  # Parent  b756eb10ea73ee4ba69c998e64a5c6e1005d74b5
+  phase-divergent update to b756eb10ea73:
+  
+  foo to bar
+  
+  diff -r b756eb10ea73 -r 502e73736632 bar
+  --- a/bar	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/bar	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,1 @@
+  -bar
+  +foo
+
+  $ hg glog
+  @  8:502e73736632 phase-divergent update to b756eb10ea73:
+  |
+  |  foo to bar
+  |   (bm) draft
+  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