Mercurial > evolve
view tests/test-evolve-content-divergence.t @ 3826:8e8bd5bb2f90
evolve: declare updated and pctx variables in stopevolve()
They will used in next patch.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 11 Jun 2018 00:43:39 +0530 |
parents | 3273b178c202 |
children | b293cce4ff55 |
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 and resolution and relocation wont result in conflicts ------------------------------------------------------------------------------ $ 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 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 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 @ 20: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 $ hg obslog -r . --all @ bbaca013758a (20) added y |\ x | 4065e1d314c3 (18) added y | | rewritten(content) as bbaca013758a using amend by test (Thu Jan 01 00:00:00 1970 +0000) | | | x 6d515d1ffc69 (19) added y | | rewritten(branch, content) as bbaca013758a using evolve by test (Thu Jan 01 00:00:00 1970 +0000) | | | x 29e08829c51f (16) added y | | rewritten(parent) as 6d515d1ffc69 using evolve by test (Thu Jan 01 00:00:00 1970 +0000) | | x | f1d75198aac4 (17) added y |/ rewritten(content) as 4065e1d314c3 using amend by test (Thu Jan 01 00:00:00 1970 +0000) | x 9c30046901ab (15) added y rewritten(content) as 29e08829c51f using amend by test (Thu Jan 01 00:00:00 1970 +0000) rewritten(branch, parent) as f1d75198aac4 using rebase by test (Thu Jan 01 00:00:00 1970 +0000) checking that relocated commit is there $ hg exp 6d515d1ffc69 --hidden # HG changeset patch # User test # Date 0 0 # Thu Jan 01 00:00:00 1970 +0000 # Node ID 6d515d1ffc6925b036c933078ccb804c26da80b2 # Parent be41fdcd0ee181081c4e42c6ee333d3dc3b3ab45 added y diff -r be41fdcd0ee1 -r 6d515d1ffc69 y --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/y Thu Jan 01 00:00:00 1970 +0000 @@ -0,0 +1,1 @@ +bar Testing when the relocation will result in conflicts and merging wont ---------------------------------------------------------------------- $ hg glog @ 20: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 $ hg up .^^^^ 0 files updated, 0 files merged, 4 files removed, 0 files unresolved $ echo z > z $ hg ci -Aqm "added z" $ hg glog -r . @ 21:884c9d1a1a84 added z | () [default] draft ~ $ echo foo > y $ hg add y $ hg amend $ hg up 884c9d1a1a84 --hidden 0 files updated, 0 files merged, 1 files removed, 0 files unresolved updated to hidden changeset 884c9d1a1a84 (hidden revision '884c9d1a1a84' was rewritten as: 3e22a949fe7d) working directory parent is obsolete! (884c9d1a1a84) (use 'hg evolve' to update to its successor: 3e22a949fe7d) $ hg rebase -r . -d bbaca013758a --config experimental.evolution.allowdivergence=True rebasing 21:884c9d1a1a84 "added z" 2 new content-divergent changesets $ echo bar > z $ hg amend $ hg glog @ 24:d2eca78cc588 added z | () [bar] draft | * 22:3e22a949fe7d added z | | () [default] draft o | 20: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 $ hg evolve --content-divergent merge:[24] added z with: [22] added z base: [21] added z rebasing "other" content-divergent changeset 3e22a949fe7d on bbaca013758a merging y warning: conflicts while merging y! (edit, then use 'hg resolve --mark') abort: unresolved merge conflicts (see hg help resolve) [255] $ hg diff diff -r bbaca013758a y --- a/y Thu Jan 01 00:00:00 1970 +0000 +++ b/y Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +1,5 @@ +<<<<<<< destination: bbaca013758a bar - test: added y watbar +======= +foo +>>>>>>> evolving: 3e22a949fe7d - test: added z diff -r bbaca013758a z --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/z Thu Jan 01 00:00:00 1970 +0000 @@ -0,0 +1,1 @@ +z $ echo foo > y $ hg resolve -m (no more unresolved files) continue: hg evolve --continue $ hg evolve --continue working directory is now at a15eb4e32166 $ hg glog @ 25:a15eb4e32166 added z | () [default] draft o 20: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 XXX: z should have bar inside, the merge definitely did not happen $ hg exp # HG changeset patch # User test # Date 0 0 # Thu Jan 01 00:00:00 1970 +0000 # Node ID a15eb4e32166b0652fdec4c1dd30c9d668323bac # Parent bbaca013758a55364955939e2d2e4536cb8d05cf added z diff -r bbaca013758a -r a15eb4e32166 y --- a/y Thu Jan 01 00:00:00 1970 +0000 +++ b/y Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +1,1 @@ -watbar +foo diff -r bbaca013758a -r a15eb4e32166 z --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/z Thu Jan 01 00:00:00 1970 +0000 @@ -0,0 +1,1 @@ +z