Mercurial > evolve
view tests/test-evolve-orphan-merge.t @ 3529:d90e0faaec80
evolve: fix stabilization of orphan merge changesets in case of conflicts
As demonstrated by tests added in previous patch, if one of the parent of a
merge changeset has a new version and merge changeset gets, running `hg evolve`
to stabilize that if results in conflicts will lead to lose of other parent of
that merge changeset when we resolve conflicts and do `hg evolve --continue`.
This patch fixes the behavior, by checking whether we are continuing evolving a
merge changeset and if yes, setting the dirstate parents according to that.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Tue, 13 Mar 2018 18:17:50 +0530 |
parents | 92f1e2408fd0 |
children | 3f056d3a1f70 |
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