Mercurial > evolve
view tests/test-evolve-content-divergence.t @ 3805:2410e7063692
evolve: implement resolution of content-divergence when on differet parents
This patch implements the basic version of resolution of content-divergence
changesets when they are on different parents but one of the parent is gca of
both the different parents.
The functionality first relocates the divergent changeset which was left behind
and then resolves the content-divergence like it resolves in normal cases.
This is a very basic implementation because it still does not work on
interrupted evolution. Test changes in this patch shows the basic functionality
working. The output of dry-run is also required to be tweaked in such cased.
Upcoming patches will add more tests and will improve the implementation to work
during conflicts too.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 01 Jun 2018 19:52:06 +0530 |
parents | 509b1e66f0b9 |
children | 99469bb3854e |
line wrap: on
line source
** Test for handling of content divergent changesets by `hg evolve` ** ==================================================================== $ cat >> $HGRCPATH <<EOF > [alias] > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) [{branch}] {phase}" > [extensions] > rebase = > EOF $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH $ hg init cdiv $ cd cdiv $ 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 Creating content-divergence with branch change where base, divergent and other have different branches ------------------------------------------------------------------------------- $ hg branch -r . foobar changed branch on 1 changesets $ hg up c41c793e0ef1 --hidden 0 files updated, 0 files merged, 0 files removed, 0 files unresolved updated to hidden changeset c41c793e0ef1 (hidden revision 'c41c793e0ef1' was rewritten as: 9e5dffcb3d48) working directory parent is obsolete! (c41c793e0ef1) (use 'hg evolve' to update to its successor: 9e5dffcb3d48) $ echo bar > d $ hg branch watwat marked working directory as branch watwat $ hg amend 2 new content-divergent changesets $ hg glog @ 6:264b04f771fb added d | () [watwat] draft | * 5:9e5dffcb3d48 added d |/ () [foobar] 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 evolve --content-divergent --config ui.interactive=True<<EOF > c > EOF merge:[6] added d with: [5] added d base: [4] added d merging "other" content-divergent changeset '9e5dffcb3d48' 0 files updated, 0 files merged, 0 files removed, 0 files unresolved content divergent changesets on different branches. choose branch for the resolution changeset. (a) default or (b) watwat or (c) foobar? c working directory is now at 23a4467c278e $ hg glog @ 7:23a4467c278e added d | () [foobar] 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 Testing merging of commit messages ----------------------------------- When base and one of the divergent has same commit messages and other divergent has different one $ echo wat > d $ hg amend $ hg up .^ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo bar > d $ hg ci -Aqm "added a d with bar in it, expect some beers" $ hg prune -r 23a4467c278e -s . --hidden 1 changesets pruned 2 new content-divergent changesets $ hg glog @ 9:59081c9c425a added a d with bar in it, expect some beers | () [default] draft | * 8:36618f77f252 added d |/ () [foobar] 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 evolve --content-divergent merge:[9] added a d with bar in it, expect some beers with: [8] added d base: [7] added d merging "other" content-divergent changeset '36618f77f252' 1 files updated, 0 files merged, 0 files removed, 0 files unresolved working directory is now at ca80aeaf4ee8 $ hg glog @ 10:ca80aeaf4ee8 added a d with bar in it, expect some beers | () [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 When base has different message and both divergents has same one $ echo foo > d $ hg amend -m "foo to d" $ hg up ca80aeaf4ee8 --hidden 1 files updated, 0 files merged, 0 files removed, 0 files unresolved updated to hidden changeset ca80aeaf4ee8 (hidden revision 'ca80aeaf4ee8' was rewritten as: eba0b02801cb) working directory parent is obsolete! (ca80aeaf4ee8) (use 'hg evolve' to update to its successor: eba0b02801cb) $ echo babar > d $ hg amend -m "foo to d" 2 new content-divergent changesets $ hg glog @ 12:0116315a1a4a foo to d | () [default] draft | * 11:eba0b02801cb foo to 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 evolve --content-divergent merge:[12] foo to d with: [11] foo to d base: [10] added a d with bar in it, expect some beers merging "other" content-divergent changeset 'eba0b02801cb' merging d warning: conflicts while merging d! (edit, then use 'hg resolve --mark') 0 files updated, 0 files merged, 0 files removed, 1 files unresolved abort: fix conflicts and run 'hg evolve --continue' or use 'hg update -C .' to abort [255] $ echo foobar > d $ hg resolve -m (no more unresolved files) continue: hg evolve --continue $ hg evolve --continue working directory is now at 3e0a8df515d6 $ hg glog @ 13:3e0a8df515d6 foo to 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 When all three base, divergent and other has different commit messages creating conflicts $ echo bar > d $ hg amend -m "bar to d, expect beers" $ hg up 3e0a8df515d6 --hidden 1 files updated, 0 files merged, 0 files removed, 0 files unresolved updated to hidden changeset 3e0a8df515d6 (hidden revision '3e0a8df515d6' was rewritten as: 9ad4721c9004) working directory parent is obsolete! (3e0a8df515d6) (use 'hg evolve' to update to its successor: 9ad4721c9004) $ echo wat > d $ hg amend -m "wat to d, wat?" 2 new content-divergent changesets $ hg glog @ 15:1e834b60df1b wat to d, wat? | () [default] draft | * 14:9ad4721c9004 bar to d, expect beers |/ () [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 evolve --content-divergent merge:[15] wat to d, wat? with: [14] bar to d, expect beers base: [13] foo to d merging "other" content-divergent changeset '9ad4721c9004' merging d warning: conflicts while merging d! (edit, then use 'hg resolve --mark') 0 files updated, 0 files merged, 0 files removed, 1 files unresolved abort: fix conflicts and run 'hg evolve --continue' or use 'hg update -C .' to abort [255] $ echo watbar > d $ hg resolve -m (no more unresolved files) continue: hg evolve --continue $ cat > editor.sh <<EOF > #!/bin/sh > printf "**showing editors text**\n\n" > cat \$1 > printf "\n**done showing editors text**\n\n" > cat > \$1 <<ENDOF > watbar to d > ENDOF > EOF $ HGEDITOR='sh ./editor.sh' hg evolve --continue **showing editors text** HG: Conflicts while merging changeset description of content-divergent changesets. HG: Resolve conflicts in commit messages to continue. <<<<<<< divergent wat to d, wat?||||||| base foo to d======= bar to d, expect beers>>>>>>> other **done showing editors text** working directory is now at 00f8d08aea43 $ hg glog @ 16:00f8d08aea43 watbar to 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 .. 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 merge:[5] added b with: [6] added b base: [2] added b rebasing "other" content-divergent changeset da4b96f4a8d6 on c7586e2a9264 updating to "local" side of the conflict: 7ed0642d644b merging "other" content-divergent changeset '11f849d7159f' 0 files updated, 0 files merged, 0 files removed, 0 files unresolved nothing changed $ hg glog @ 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 exp # HG changeset patch # User test # Date 0 0 # Thu Jan 01 00:00:00 1970 +0000 # Node ID 7ed0642d644bb9ad93d252dd9ffe7b4729febe48 # Parent c7586e2a92645e473645847a7b69a6dc52be4276 added b diff -r c7586e2a9264 -r 7ed0642d644b b --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/b Thu Jan 01 00:00:00 1970 +0000 @@ -0,0 +1,1 @@ +bar