Mercurial > evolve
view tests/test-evolve-content-divergence.t @ 3802:4bad80f1aad3
evolve: pop up editor if conflicts occur while merging commit messages
Last patch added support for merging commit messages while resolving content
divergence. In case of conflicts we fallback to one of the divergent commit
messages.
After this patch, we will pop up an editor where user has to resolve the
conflicts in the commit messages and then continue.
Tests are added for this. We need to fix handling in test-sharing.t to use
HGEDITOR to fix conflicts and pass the new commit message.
Future improvement can be that we should respect HGMERGE while merging commit
descriptions too.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 06 Jun 2018 03:26:47 +0530 |
parents | ee78135b2f45 |
children | 509b1e66f0b9 |
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] > 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