tests: add test of resolution of content-divergent stacks
authorPulkit Goyal <7895pulkit@gmail.com>
Tue, 12 Jun 2018 21:13:02 +0530
changeset 3844 48fbccfd1dff
parent 3843 f0096db2a7b1
child 3845 5c964ebe4d4b
tests: add test of resolution of content-divergent stacks This patch adds a test of resolution of content-divergence stacks where a series of changesets get mutated as two different series resulting in whole content-divergent stacks. As the tests shows, we are not processing the changesets in right order which needs to be fixed first.
tests/test-evolve-content-divergence.t
--- a/tests/test-evolve-content-divergence.t	Tue Jun 12 19:00:12 2018 +0530
+++ b/tests/test-evolve-content-divergence.t	Tue Jun 12 21:13:02 2018 +0530
@@ -4,6 +4,8 @@
   $ cat >> $HGRCPATH <<EOF
   > [alias]
   > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) [{branch}] {phase}"
+  > [phases]
+  > publish = False
   > [extensions]
   > rebase =
   > EOF
@@ -732,3 +734,202 @@
   +++ b/z	Thu Jan 01 00:00:00 1970 +0000
   @@ -0,0 +1,1 @@
   +z
+
+  $ cd ..
+
+Resolving content-divergence of a stack with same parents
+---------------------------------------------------------
+
+  $ hg init stacktest
+  $ cd stacktest
+  $ echo ".*\.orig" > .hgignore
+  $ hg add .hgignore
+  $ hg ci -m "added hgignore"
+  $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
+
+  $ hg glog
+  @  4:c41c793e0ef1 added d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ cd ..
+  $ hg init stack2
+  $ cd stack2
+  $ hg pull ../stacktest
+  pulling from ../stacktest
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 5 changesets with 5 changes to 5 files
+  new changesets 8fa14d15e168:c41c793e0ef1
+  (run 'hg update' to get a working copy)
+  $ hg glog
+  o  4:c41c793e0ef1 added d
+  |   () [default] draft
+  o  3:ca1b80f7960a added c
+  |   () [default] draft
+  o  2:b1661037fa25 added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg up c7586e2a9264
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo bar > a
+  $ hg amend -m "watbar to a"
+  3 new orphan changesets
+  $ hg evolve --all
+  move:[2] added b
+  atop:[5] watbar to a
+  move:[3] added c
+  atop:[6] added b
+  move:[4] added d
+  atop:[7] added c
+  working directory is now at 513e3267034e
+  $ hg glog
+  @  8:513e3267034e added d
+  |   () [default] draft
+  o  7:accb7a2b6ae9 added c
+  |   () [default] draft
+  o  6:60280764eb0e added b
+  |   () [default] draft
+  o  5:2587cb3ef1fe watbar to a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ cd ../stacktest
+  $ hg up .^^^
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ echo wat > a
+  $ hg amend -m "watbar to a"
+  3 new orphan changesets
+  $ hg evolve --all
+  move:[2] added b
+  atop:[5] watbar to a
+  move:[3] added c
+  atop:[6] added b
+  move:[4] added d
+  atop:[7] added c
+  working directory is now at c72d2885eb51
+  $ hg glog
+  @  8:c72d2885eb51 added d
+  |   () [default] draft
+  o  7:3ce4be6d8e5e added c
+  |   () [default] draft
+  o  6:d5f148423c16 added b
+  |   () [default] draft
+  o  5:8e222f257bbf watbar to a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg pull ../stack2
+  pulling from ../stack2
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 1 changes to 4 files (+1 heads)
+  4 new obsolescence markers
+  8 new content-divergent changesets
+  new changesets 2587cb3ef1fe:513e3267034e
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+
+  $ hg glog
+  *  12:513e3267034e added d
+  |   () [default] draft
+  *  11:accb7a2b6ae9 added c
+  |   () [default] draft
+  *  10:60280764eb0e added b
+  |   () [default] draft
+  *  9:2587cb3ef1fe watbar to a
+  |   () [default] draft
+  | @  8:c72d2885eb51 added d
+  | |   () [default] draft
+  | *  7:3ce4be6d8e5e added c
+  | |   () [default] draft
+  | *  6:d5f148423c16 added b
+  | |   () [default] draft
+  | *  5:8e222f257bbf watbar to a
+  |/    () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+XXX: we are not resolving divergence in the correct order here
+  $ hg evolve --all --content-divergent
+  skipping c72d2885eb51: have a different parent than 513e3267034e (not handled yet)
+  | c72d2885eb51, 513e3267034e are not based on the same changeset.
+  | With the current state of its implementation, 
+  | evolve does not work in that case.
+  | rebase one of them next to the other and run 
+  | this command again.
+  | - either: hg rebase --dest 'p1(c72d2885eb51)' -r 513e3267034e
+  | - or:     hg rebase --dest 'p1(513e3267034e)' -r c72d2885eb51
+  merge:[5] watbar to a
+  with: [9] watbar to a
+  base: [1] added a
+  updating to "local" side of the conflict: 8e222f257bbf
+  merging "other" content-divergent changeset '2587cb3ef1fe'
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  abort: fix conflicts and see `hg help evolve.interrupted`
+  [255]
+
+  $ echo watbar > a
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+
+  $ hg evolve --continue
+  6 new orphan changesets
+  skipping d5f148423c16: have a different parent than 60280764eb0e (not handled yet)
+  | d5f148423c16, 60280764eb0e are not based on the same changeset.
+  | With the current state of its implementation, 
+  | evolve does not work in that case.
+  | rebase one of them next to the other and run 
+  | this command again.
+  | - either: hg rebase --dest 'p1(d5f148423c16)' -r 60280764eb0e
+  | - or:     hg rebase --dest 'p1(60280764eb0e)' -r d5f148423c16
+  skipping 3ce4be6d8e5e: have a different parent than accb7a2b6ae9 (not handled yet)
+  | 3ce4be6d8e5e, accb7a2b6ae9 are not based on the same changeset.
+  | With the current state of its implementation, 
+  | evolve does not work in that case.
+  | rebase one of them next to the other and run 
+  | this command again.
+  | - either: hg rebase --dest 'p1(3ce4be6d8e5e)' -r accb7a2b6ae9
+  | - or:     hg rebase --dest 'p1(accb7a2b6ae9)' -r 3ce4be6d8e5e
+  working directory is now at df46e196f3c4
+
+  $ hg glog
+  @  13:df46e196f3c4 watbar to a
+  |   () [default] draft
+  | *  12:513e3267034e added d
+  | |   () [default] draft
+  | *  11:accb7a2b6ae9 added c
+  | |   () [default] draft
+  | *  10:60280764eb0e added b
+  | |   () [default] draft
+  | x  9:2587cb3ef1fe watbar to a
+  |/    () [default] draft
+  | *  8:c72d2885eb51 added d
+  | |   () [default] draft
+  | *  7:3ce4be6d8e5e added c
+  | |   () [default] draft
+  | *  6:d5f148423c16 added b
+  | |   () [default] draft
+  | x  5:8e222f257bbf watbar to a
+  |/    () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft