tests: add tests for resolving content-divergence when different parents
authorPulkit Goyal <7895pulkit@gmail.com>
Thu, 07 Jun 2018 15:54:32 +0530
changeset 3806 99469bb3854e
parent 3805 2410e7063692
child 3807 03ccdc753582
tests: add tests for resolving content-divergence when different parents This patch adds more tests for cases when we try to resolve content-divergence when they are on different parents. The last test shows the we are somehow missing the relocated commit in interrupted transaction. This will be fixed in next patch.
tests/test-evolve-content-divergence.t
--- a/tests/test-evolve-content-divergence.t	Fri Jun 01 19:52:06 2018 +0530
+++ b/tests/test-evolve-content-divergence.t	Thu Jun 07 15:54:32 2018 +0530
@@ -283,7 +283,7 @@
   $ cd ..
 
 Testing resolution of content-divergent changesets when they are on different
-parents
+parents and resolution and relocation wont result in conflicts
 ------------------------------------------------------------------------------
 
   $ hg init multiparents
@@ -369,3 +369,198 @@
   +++ b/b	Thu Jan 01 00:00:00 1970 +0000
   @@ -0,0 +1,1 @@
   +bar
+
+Resolving orphans to get back to a normal graph
+
+  $ hg evolve --all
+  move:[3] added c
+  atop:[5] added b
+  move:[4] added d
+  atop:[8] added c
+  working directory is now at b6b20b8eefdc
+  $ hg glog
+  @  9:b6b20b8eefdc added d
+  |   () [default] draft
+  o  8:7c46f743e62f added c
+  |   () [default] draft
+  o  5:7ed0642d644b added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+More testing!
+
+  $ hg up .^^
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo x > x
+  $ hg ci -Aqm "added x"
+  $ hg glog -r .
+  @  10:cfae5f87cd34 added x
+  |   () [default] draft
+  ~
+
+  $ echo foo > x
+  $ hg branch bar
+  marked working directory as branch bar
+  (branches are permanent and global, did you want a bookmark?)
+  $ hg amend -m "added foo to x"
+
+  $ hg up cfae5f87cd34 --hidden
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset cfae5f87cd34
+  (hidden revision 'cfae5f87cd34' was rewritten as: 580d9d182d90)
+  working directory parent is obsolete! (cfae5f87cd34)
+  (use 'hg evolve' to update to its successor: 580d9d182d90)
+  $ hg rebase -r . -d b6b20b8eefdc --config experimental.evolution.allowdivergence=True
+  rebasing 10:cfae5f87cd34 "added x"
+  2 new content-divergent changesets
+
+  $ hg glog
+  @  12:c4d1990428e3 added x
+  |   () [default] draft
+  | *  11:580d9d182d90 added foo to x
+  | |   () [bar] draft
+  o |  9:b6b20b8eefdc added d
+  | |   () [default] draft
+  o |  8:7c46f743e62f added c
+  |/    () [default] draft
+  o  5:7ed0642d644b added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[12] added x
+  with: [11] added foo to x
+  base: [10] added x
+  rebasing "other" content-divergent changeset 580d9d182d90 on b6b20b8eefdc
+  updating to "local" side of the conflict: c4d1990428e3
+  merging "other" content-divergent changeset 'd3bfc0b3f350'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  working directory is now at be41fdcd0ee1
+
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Branch bar
+  # Node ID be41fdcd0ee181081c4e42c6ee333d3dc3b3ab45
+  # Parent  b6b20b8eefdce1f32126c71d20bdb72a62b38268
+  added foo to x
+  
+  diff -r b6b20b8eefdc -r be41fdcd0ee1 x
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/x	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +foo
+
+The above `hg exp` and the following log call demonstrates that message, content
+and branch change is preserved in case of relocation
+  $ hg glog
+  @  14:be41fdcd0ee1 added foo to x
+  |   () [bar] draft
+  o  9:b6b20b8eefdc added d
+  |   () [default] draft
+  o  8:7c46f743e62f added c
+  |   () [default] draft
+  o  5:7ed0642d644b added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+Testing when both the content-divergence are on different parents and resolution
+will lead to conflicts
+---------------------------------------------------------------------------------
+
+  $ hg up .^^^
+  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
+
+  $ echo y > y
+  $ hg ci -Aqm "added y"
+  $ hg glog -r .
+  @  15:9c30046901ab added y
+  |   () [default] draft
+  ~
+
+  $ echo bar > y
+  $ hg amend
+
+  $ hg up 9c30046901ab --hidden
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  updated to hidden changeset 9c30046901ab
+  (hidden revision '9c30046901ab' was rewritten as: 29e08829c51f)
+  working directory parent is obsolete! (9c30046901ab)
+  (use 'hg evolve' to update to its successor: 29e08829c51f)
+  $ hg rebase -r . -d be41fdcd0ee1 --config experimental.evolution.allowdivergence=True
+  rebasing 15:9c30046901ab "added y"
+  2 new content-divergent changesets
+  $ echo wat > y
+  $ hg amend
+
+  $ hg glog
+  @  18:4065e1d314c3 added y
+  |   () [bar] draft
+  | *  16:29e08829c51f added y
+  | |   () [default] draft
+  o |  14:be41fdcd0ee1 added foo to x
+  | |   () [bar] draft
+  o |  9:b6b20b8eefdc added d
+  | |   () [default] draft
+  o |  8:7c46f743e62f added c
+  |/    () [default] draft
+  o  5:7ed0642d644b added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+  $ hg evolve --content-divergent
+  merge:[18] added y
+  with: [16] added y
+  base: [15] added y
+  rebasing "other" content-divergent changeset 29e08829c51f on be41fdcd0ee1
+  updating to "local" side of the conflict: 4065e1d314c3
+  merging "other" content-divergent changeset '6d515d1ffc69'
+  merging y
+  warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  transaction abort!
+  rollback completed
+  abort: fix conflicts and run 'hg evolve --continue' or use 'hg update -C .' to abort
+  [255]
+
+  $ echo watbar > y
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg evolve --continue
+  $ hg evolve --continue
+  working directory is now at bbaca013758a
+
+  $ hg glog
+  @  19:bbaca013758a added y
+  |   () [bar] draft
+  o  14:be41fdcd0ee1 added foo to x
+  |   () [bar] draft
+  o  9:b6b20b8eefdc added d
+  |   () [default] draft
+  o  8:7c46f743e62f added c
+  |   () [default] draft
+  o  5:7ed0642d644b added b
+  |   () [default] draft
+  o  1:c7586e2a9264 added a
+  |   () [default] draft
+  o  0:8fa14d15e168 added hgignore
+      () [default] draft
+
+checking that relocated commit is there
+  $ hg exp 6d515d1ffc69 --hidden
+  abort: unknown revision '6d515d1ffc69'!
+  [255]