tests: add tests for resolving content-divergence with parent change
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 01 Jun 2018 19:57:19 +0530
changeset 3804 509b1e66f0b9
parent 3803 1de50022e888
child 3805 2410e7063692
tests: add tests for resolving content-divergence with parent change This patch adds a new test file test-evolve-content-divergence.t which tests the resolution of content divergence when the divergent changesets does not have the same parents.
tests/test-evolve-content-divergence.t
--- a/tests/test-evolve-content-divergence.t	Wed Jun 06 03:49:17 2018 +0530
+++ b/tests/test-evolve-content-divergence.t	Fri Jun 01 19:57:19 2018 +0530
@@ -5,6 +5,7 @@
   > [alias]
   > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) [{branch}] {phase}"
   > [extensions]
+  > rebase =
   > EOF
   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
 
@@ -278,3 +279,80 @@
   |   () [default] draft
   o  0:8fa14d15e168 added hgignore
       () [default] draft
+
+  $ cd ..
+
+Testing resolution of content-divergent changesets when they are on different
+parents
+------------------------------------------------------------------------------
+
+  $ hg init multiparents
+  $ cd multiparents
+  $ 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
+
+  $ hg up .^^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo bar > b
+  $ hg amend
+  2 new orphan changesets
+
+  $ hg rebase -r b1661037fa25 -d 8fa14d15e168 --hidden --config experimental.evolution.allowdivergence=True
+  rebasing 2:b1661037fa25 "added b"
+  2 new content-divergent changesets
+
+  $ hg glog
+  *  6:da4b96f4a8d6 added b
+  |   () [default] draft
+  | @  5:7ed0642d644b added b
+  | |   () [default] draft
+  | | *  4:c41c793e0ef1 added d
+  | | |   () [default] draft
+  | | *  3:ca1b80f7960a added c
+  | | |   () [default] draft
+  | | x  2:b1661037fa25 added b
+  | |/    () [default] draft
+  | o  1:c7586e2a9264 added a
+  |/    () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  skipping 7ed0642d644b: have a different parent than da4b96f4a8d6 (not handled yet)
+  | 7ed0642d644b, da4b96f4a8d6 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(7ed0642d644b)' -r da4b96f4a8d6
+  | - or:     hg rebase --dest 'p1(da4b96f4a8d6)' -r 7ed0642d644b
+
+  $ hg glog
+  *  6:da4b96f4a8d6 added b
+  |   () [default] draft
+  | @  5:7ed0642d644b added b
+  | |   () [default] draft
+  | | *  4:c41c793e0ef1 added d
+  | | |   () [default] draft
+  | | *  3:ca1b80f7960a added c
+  | | |   () [default] draft
+  | | x  2:b1661037fa25 added b
+  | |/    () [default] draft
+  | o  1:c7586e2a9264 added a
+  |/    () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft