Mercurial > evolve
view tests/test-evolve-content-divergence.t @ 3804:509b1e66f0b9
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.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 01 Jun 2018 19:57:19 +0530 |
parents | 4bad80f1aad3 |
children | 2410e7063692 |
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 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