Mercurial > evolve
view tests/test-evolve-orphan-merge.t @ 3530:3f056d3a1f70
tests: add more tests related to stabilization of orphaned merge commit
This patch more tests related to stabilization of orphaned merge commit.
Stabilization of a merge changeset with both the parents is not supported right
now and prints a message on how to do that. Maybe we should do that internally
as a part of `hg evolve` but I need to think about this.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Tue, 13 Mar 2018 19:06:14 +0530 |
parents | d90e0faaec80 |
children | 329056287ef5 |
line wrap: on
line source
** 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 c5405d2da7a1 $ hg glog @ 12:c5405d2da7a1 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:c5405d2da7a1 tag: tip parent: 11:31c317b7bdb1 parent: 9:d0f84b25d4e3 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: foobar to c 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 @ 13:928097d0b5b5 foo to c | () draft | * 12:c5405d2da7a1 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:[12] foobar to c atop:[13] 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 12:c5405d2da7a1 "foobar to c" working directory is now at dc1948a6eeab $ hg glog @ 14:dc1948a6eeab foobar to c |\ () draft | o 13:928097d0b5b5 foo to c | | () draft o | 9:d0f84b25d4e3 bar to c |/ () draft o 0:8fa14d15e168 added hgignore () draft 3) When stabilizing other changesets resulted in orphan merge changeset ----------------------------------------------------------------------- $ hg prune -r d0f84b25d4e3 -r 928097d0b5b5 -r dc1948a6eeab 0 files updated, 0 files merged, 1 files removed, 0 files unresolved working directory now at 8fa14d15e168 3 changesets pruned $ for ch in l m; do echo foo > $ch; hg ci -Aqm "added "$ch; done; $ hg up 8fa14d15e168 0 files updated, 0 files merged, 2 files removed, 0 files unresolved $ for ch in x y; do echo foo > $ch; hg ci -Aqm "added "$ch; done; $ hg glog @ 18:863d11043c67 added y | () draft o 17:3f2247835c1d added x | () draft | o 16:e44dc179e7f5 added m | | () draft | o 15:8634bee7bf1e added l |/ () draft o 0:8fa14d15e168 added hgignore () draft $ hg merge 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci -m "merge commit" $ hg up 8634bee7bf1e 0 files updated, 0 files merged, 3 files removed, 0 files unresolved $ echo bar > l $ hg amend 2 new orphan changesets $ hg glog @ 20:fccc9de66799 added l | () draft | * 19:190763373d8b merge commit | |\ () draft | | o 18:863d11043c67 added y | | | () draft +---o 17:3f2247835c1d added x | | () draft | * 16:e44dc179e7f5 added m | | () draft | x 15:8634bee7bf1e added l |/ () draft o 0:8fa14d15e168 added hgignore () draft $ hg evolve --all move:[16] added m atop:[20] added l move:[19] merge commit atop:[21] added m working directory is now at a446ad3e6700 $ hg glog @ 22:a446ad3e6700 merge commit |\ () draft | o 21:495d2039f8f1 added m | | () draft | o 20:fccc9de66799 added l | | () draft o | 18:863d11043c67 added y | | () draft o | 17:3f2247835c1d added x |/ () draft o 0:8fa14d15e168 added hgignore () draft 4) When both the parents of the merge changeset are obsolete with a succ ------------------------------------------------------------------------ $ hg prune -r a446ad3e6700 -r 495d2039f8f1 -r 863d11043c67 0 files updated, 0 files merged, 3 files removed, 0 files unresolved working directory now at fccc9de66799 3 changesets pruned $ hg glog @ 20:fccc9de66799 added l | () draft | o 17:3f2247835c1d added x |/ () draft o 0:8fa14d15e168 added hgignore () draft $ hg merge 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ hg ci -m "merged l and x" $ hg up fccc9de66799 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo foobar > l $ hg amend 1 new orphan changesets $ hg up 3f2247835c1d 1 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo bar > x $ hg amend $ hg glog @ 25:cdf6547da25f added x | () draft | o 24:3f371171d767 added l |/ () draft | * 23:7b78a9784f3e merged l and x | |\ () draft +---x 20:fccc9de66799 added l | | () draft | x 17:3f2247835c1d added x |/ () draft o 0:8fa14d15e168 added hgignore () draft XXX: We should handle this case too $ hg evolve --all warning: no support for evolving merge changesets with two obsolete parents yet (Redo the merge (7b78a9784f3e) and use `hg prune <old> --succ <new>` to obsolete the old one)