Mercurial > evolve
changeset 3528:92f1e2408fd0
tests: add a test file of resolving orphaness of merge changesets
This patch adds a new test file named test-evolve-orphan-merge.t which contains
test cases when `hg evolve` try to stabilize a merge changeset which was orphan.
This file contains 20-30% of all the cases as we have got something to fix
before we add tests for rest of the cases. Going by this approach will make sure
we don't live unfixed cases in the test file and the test files does not become
a pile of hacks which are used to get in state when we fix the bugs.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Tue, 13 Mar 2018 15:29:35 +0530 |
parents | 7b4d1bfb6b7d |
children | d90e0faaec80 |
files | tests/test-evolve-orphan-merge.t |
diffstat | 1 files changed, 330 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-evolve-orphan-merge.t Tue Mar 13 15:29:35 2018 +0530 @@ -0,0 +1,330 @@ +** Testing resolution of orphans by `hg evolve` when merges are involved ** + + $ cat >> $HGRCPATH <<EOF + > [ui] + > interactive = True + > [alias] + > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}" + > [extensions] + > rebase = + > EOF + $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH + +Repo Setup + + $ hg init repo + $ cd repo + $ echo ".*\.orig" > .hgignore + $ hg add .hgignore + $ hg ci -m "added hgignore" + +An orphan merge changeset with one of the parent obsoleted +========================================================== + +1) When merging both the parents does not result in conflicts +------------------------------------------------------------- + + $ echo foo > a + $ hg ci -Aqm "added a" + $ hg up .^ + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo foo > b + $ hg ci -Aqm "added b" + $ hg merge + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + $ hg ci -m "merging a and b" + + $ hg glog + @ 3:3b2b6f4652ee merging a and b + |\ () draft + | o 2:d76850646258 added b + | | () draft + o | 1:c7586e2a9264 added a + |/ () draft + o 0:8fa14d15e168 added hgignore + () draft + +Testing with obsoleting the second parent + + $ hg up d76850646258 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo bar > b + $ hg amend + 1 new orphan changesets + + $ hg glog + @ 4:64370c9805e7 added b + | () draft + | * 3:3b2b6f4652ee merging a and b + | |\ () draft + +---x 2:d76850646258 added b + | | () draft + | o 1:c7586e2a9264 added a + |/ () draft + o 0:8fa14d15e168 added hgignore + () draft + + $ hg evolve --all + move:[3] merging a and b + atop:[4] added b + working directory is now at 91fd62122a4b + + $ hg glog + @ 5:91fd62122a4b merging a and b + |\ () draft + | o 4:64370c9805e7 added b + | | () draft + o | 1:c7586e2a9264 added a + |/ () draft + o 0:8fa14d15e168 added hgignore + () draft + + $ hg parents + changeset: 5:91fd62122a4b + tag: tip + parent: 4:64370c9805e7 + parent: 1:c7586e2a9264 + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: merging a and b + + +Testing with obsoleting the first parent + + $ hg up c7586e2a9264 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ echo bar > a + $ hg amend + 1 new orphan changesets + + $ hg glog + @ 6:3d41537b44ca added a + | () draft + | * 5:91fd62122a4b merging a and b + | |\ () draft + +---o 4:64370c9805e7 added b + | | () draft + | x 1:c7586e2a9264 added a + |/ () draft + o 0:8fa14d15e168 added hgignore + () draft + + $ hg evolve --all + move:[5] merging a and b + atop:[6] added a + working directory is now at 968d205ba4d8 + + $ hg glog + @ 7:968d205ba4d8 merging a and b + |\ () draft + | o 6:3d41537b44ca added a + | | () draft + o | 4:64370c9805e7 added b + |/ () draft + o 0:8fa14d15e168 added hgignore + () draft + + $ hg parents + changeset: 7:968d205ba4d8 + tag: tip + parent: 6:3d41537b44ca + parent: 4:64370c9805e7 + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: merging a and b + +2) When merging both the parents resulted in conflicts +------------------------------------------------------ + + $ hg up 8fa14d15e168 + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ echo foo > c + $ hg ci -Aqm "foo to c" + $ hg prev + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + [0] added hgignore + $ echo bar > c + $ hg ci -Aqm "bar to c" + + $ hg glog + @ 9:d0f84b25d4e3 bar to c + | () draft + | o 8:1c165c673853 foo to c + |/ () draft + | o 7:968d205ba4d8 merging a and b + | |\ () draft + +---o 6:3d41537b44ca added a + | | () draft + | o 4:64370c9805e7 added b + |/ () draft + o 0:8fa14d15e168 added hgignore + () draft + +Prune old test changesets to have clear graph view + $ hg prune -r 64370c9805e7 -r 3d41537b44ca -r 968d205ba4d8 + 3 changesets pruned + + $ hg glog + @ 9:d0f84b25d4e3 bar to c + | () draft + | o 8:1c165c673853 foo to c + |/ () draft + o 0:8fa14d15e168 added hgignore + () draft + + $ hg merge + merging c + warning: conflicts while merging c! (edit, then use 'hg resolve --mark') + 0 files updated, 0 files merged, 0 files removed, 1 files unresolved + use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon + [1] + $ echo foobar > c + $ hg resolve -m + (no more unresolved files) + $ hg ci -m "foobar to c" + + $ hg glog + @ 10:fd41d25a3e90 foobar to c + |\ () draft + | o 9:d0f84b25d4e3 bar to c + | | () draft + o | 8:1c165c673853 foo to c + |/ () draft + o 0:8fa14d15e168 added hgignore + () draft + +Testing with first parent obsoleted + + $ hg up 1c165c673853 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo FOO > c + $ hg amend + 1 new orphan changesets + + $ hg glog + @ 11:31c317b7bdb1 foo to c + | () draft + | * 10:fd41d25a3e90 foobar to c + | |\ () draft + +---o 9:d0f84b25d4e3 bar to c + | | () draft + | x 8:1c165c673853 foo to c + |/ () draft + o 0:8fa14d15e168 added hgignore + () draft + + $ hg evolve --all + move:[10] foobar to c + atop:[11] foo to c + merging c + warning: conflicts while merging c! (edit, then use 'hg resolve --mark') + evolve failed! + fix conflict and run 'hg evolve --continue' or use 'hg update -C .' to abort + abort: unresolved merge conflicts (see hg help resolve) + [255] + + $ echo FOObar > c + $ hg resolve -m + (no more unresolved files) + continue: hg evolve --continue + $ hg evolve --continue + evolving 10:fd41d25a3e90 "foobar to c" + working directory is now at 6b42180a13dd + +XXX: we lost the second parent here after interrupted evolve + $ hg glog + @ 12:6b42180a13dd foobar to c + | () draft + o 11:31c317b7bdb1 foo to c + | () draft + | o 9:d0f84b25d4e3 bar to c + |/ () draft + o 0:8fa14d15e168 added hgignore + () draft + + $ hg parents + changeset: 12:6b42180a13dd + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: foobar to c + +Getting back to a state from where we can test the same thing with obsoleting +the second parent + + $ hg prune -r . + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + working directory now at 31c317b7bdb1 + 1 changesets pruned + $ hg merge + merging c + warning: conflicts while merging c! (edit, then use 'hg resolve --mark') + 0 files updated, 0 files merged, 0 files removed, 1 files unresolved + use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon + [1] + + $ echo FOObar > c + $ hg resolve -m + (no more unresolved files) + $ hg commit -m "FOObar to c" + + $ hg glog + @ 13:14ac829917d7 FOObar to c + |\ () draft + | o 11:31c317b7bdb1 foo to c + | | () draft + o | 9:d0f84b25d4e3 bar to c + |/ () draft + o 0:8fa14d15e168 added hgignore + () draft + +Testing a conlficting merge with second parent obsoleted + + $ hg up 31c317b7bdb1 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo foo > c + $ hg amend + 1 new orphan changesets + + $ hg glog + @ 14:928097d0b5b5 foo to c + | () draft + | * 13:14ac829917d7 FOObar to c + | |\ () draft + +---x 11:31c317b7bdb1 foo to c + | | () draft + | o 9:d0f84b25d4e3 bar to c + |/ () draft + o 0:8fa14d15e168 added hgignore + () draft + + $ hg evolve --all + move:[13] FOObar to c + atop:[14] foo to c + merging c + warning: conflicts while merging c! (edit, then use 'hg resolve --mark') + evolve failed! + fix conflict and run 'hg evolve --continue' or use 'hg update -C .' to abort + abort: unresolved merge conflicts (see hg help resolve) + [255] + + $ echo foobar > c + $ hg resolve -m + (no more unresolved files) + continue: hg evolve --continue + + $ hg evolve --continue + evolving 13:14ac829917d7 "FOObar to c" + working directory is now at 910c14950386 + +XXX: we lost a parent here again. + $ hg glog + @ 15:910c14950386 FOObar to c + | () draft + o 14:928097d0b5b5 foo to c + | () draft + | o 9:d0f84b25d4e3 bar to c + |/ () draft + o 0:8fa14d15e168 added hgignore + () draft