Mercurial > evolve
diff tests/test-evolve-content-divergent-stack.t @ 5572:d7d954b6d518
evolve: remove swapping nodes logic while resolving divergence
Before this patch, while solving content-divergence if one of the
divergent cset need to relocate to resolution parent we used to set that
cset to "other" side; so it was like we are always going to relocate "other"
side which made us to swap the two if "divergent" cset need to relocate.
Above mentioned solution for relocating cset was not good and led us to incorrect
output in some cases.
So this patch, simplify the logic and remove the swapping thing and clearly depend
on resolution parent to check if any of the divergent cset needs to relocate.
This also means that now in some cases if both the divergent csets needs
to relocate, both will be relocated. Even before this patch, there are some cases
where both the divergent csets relocated but not in every case where it should
have.
Coming to the changes in test files:
1) changes in order of merging the two divergent csets is due to fact that
now "divergent" and "other" are not swapped and hence "divergent" will be at
local side and "other" will be at "other", which also results in change in
the hash id for some cases.
2) extra changesets: which is the result of the fact that now we don't miss
any case where both the divergent csets should be based on resolution parent
before performing the merge -> which caught some cases and performed relocation,
hence extra changesets. Although you can find that there is no changes in file
content because of these relocation, but I remember loosing some data because
of not relocating the "divergent", so why leave any risk out there by not
relocating "other" to the resolution parent.
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Sun, 20 Sep 2020 09:22:04 +0530 |
parents | 4c3656aaacc6 |
children | 6289ddfb9d48 |
line wrap: on
line diff
--- a/tests/test-evolve-content-divergent-stack.t Fri Sep 25 11:06:46 2020 -0700 +++ b/tests/test-evolve-content-divergent-stack.t Sun Sep 20 09:22:04 2020 +0530 @@ -149,25 +149,28 @@ with: [10] added b base: [2] added b rebasing "divergent" content-divergent changeset d5f148423c16 on df93a529fa42 + rebasing "other" content-divergent changeset 88516dccf68a on df93a529fa42 0 files updated, 0 files merged, 0 files removed, 0 files unresolved merge:[7] added c with: [11] added c base: [3] added c - rebasing "divergent" content-divergent changeset 3ce4be6d8e5e on 365f419742a3 + rebasing "divergent" content-divergent changeset 3ce4be6d8e5e on aca5a88a1692 + rebasing "other" content-divergent changeset 9e5fb1d5b955 on aca5a88a1692 0 files updated, 0 files merged, 0 files removed, 0 files unresolved merge:[8] added d with: [12] added d base: [4] added d - rebasing "divergent" content-divergent changeset c72d2885eb51 on a18171c7d9e7 + rebasing "divergent" content-divergent changeset c72d2885eb51 on 67e04919c9a4 + rebasing "other" content-divergent changeset 15c781f93cac on 67e04919c9a4 0 files updated, 0 files merged, 0 files removed, 0 files unresolved working directory is now at df93a529fa42 $ hg glog - o 19:59d49942cf47 added d + o 22:e72164a86fb4 added d | () [default] draft - o 17:a18171c7d9e7 added c + o 19:67e04919c9a4 added c | () [default] draft - o 15:365f419742a3 added b + o 16:aca5a88a1692 added b | () [default] draft @ 13:df93a529fa42 watbar to a | () [default] draft @@ -182,24 +185,24 @@ merge conflict. $ hg log -r "desc('added c')" -p - changeset: 17:a18171c7d9e7 - parent: 15:365f419742a3 + changeset: 19:67e04919c9a4 + parent: 16:aca5a88a1692 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: added c - diff -r 365f419742a3 -r a18171c7d9e7 c + diff -r aca5a88a1692 -r 67e04919c9a4 c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/c Thu Jan 01 00:00:00 1970 +0000 @@ -0,0 +1,1 @@ +foo - $ hg strip -r 16: --hidden - saved backup bundle to $TESTTMP/stacktest/.hg/strip-backup/b949c7ad8d83-6039d2cc-backup.hg + $ hg strip -r 17: --hidden + saved backup bundle to $TESTTMP/stacktest/.hg/strip-backup/f1cd8f167491-3817ebd7-backup.hg 4 new orphan changesets 4 new content-divergent changesets $ hg glog - o 15:365f419742a3 added b + o 16:aca5a88a1692 added b | () [default] draft @ 13:df93a529fa42 watbar to a | () [default] draft @@ -223,7 +226,7 @@ () [default] draft $ hg next 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - [15] added b + [16] added b $ echo conflict > c $ hg amend -A adding c @@ -234,12 +237,37 @@ $ echo new_file > newfile $ hg amend -Am "added c and newfile" adding newfile + $ hg glog + @ 18:2ecfb60af48a added c and newfile + | () [default] draft + | o 17:5907cbc074a0 added b + | | () [default] draft + | o 13:df93a529fa42 watbar to a + | | () [default] draft + | | * 12:15c781f93cac added d + | | | () [default] draft + +---x 11:9e5fb1d5b955 added c + | | () [default] draft + x | 10:88516dccf68a added b + | | () [default] draft + x | 9:82b74d5dc678 watbar to a + |/ () [default] draft + | * 8:c72d2885eb51 added d + | | () [default] draft + | * 7:3ce4be6d8e5e added c + | | () [default] draft + | x 6:d5f148423c16 added b + | | () [default] draft + | x 5:8e222f257bbf watbar to a + |/ () [default] draft + o 0:8fa14d15e168 added hgignore + () [default] draft $ hg evolve --content-divergent -r 7 merge:[7] added c - with: [17] added c and newfile + with: [18] added c and newfile base: [3] added c - rebasing "divergent" content-divergent changeset 3ce4be6d8e5e on fb488ec29dfa + rebasing "divergent" content-divergent changeset 3ce4be6d8e5e on 5907cbc074a0 merging c warning: conflicts while merging c! (edit, then use 'hg resolve --mark') unresolved merge conflicts @@ -252,23 +280,52 @@ $ hg evolve --continue evolving 7:3ce4be6d8e5e "added c" + rebasing "other" content-divergent changeset 2ecfb60af48a on 5907cbc074a0 + merging c + warning: conflicts while merging c! (edit, then use 'hg resolve --mark') + unresolved merge conflicts + (see 'hg help evolve.interrupted') + [1] + $ hg diff + diff -r 5907cbc074a0 c + --- a/c Thu Jan 01 00:00:00 1970 +0000 + +++ b/c Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,5 @@ + +<<<<<<< destination: 5907cbc074a0 - test: added b + conflict + +======= + +foo + +>>>>>>> evolving: 2ecfb60af48a - test: added c and newfile + diff -r 5907cbc074a0 newfile + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/newfile Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +new_file + + $ echo c > c + $ hg res -m + (no more unresolved files) + continue: hg evolve --continue + $ hg evolve -c + evolving 18:2ecfb60af48a "added c and newfile" 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - working directory is now at 3d278b2f60ff + working directory is now at 7e8d59a0286a + $ hg log -p -l1 - changeset: 19:3d278b2f60ff + changeset: 21:7e8d59a0286a tag: tip - parent: 16:fb488ec29dfa + parent: 17:5907cbc074a0 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: added c and newfile - diff -r fb488ec29dfa -r 3d278b2f60ff c + diff -r 5907cbc074a0 -r 7e8d59a0286a c --- a/c Thu Jan 01 00:00:00 1970 +0000 +++ b/c Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +1,1 @@ -conflict +c - diff -r fb488ec29dfa -r 3d278b2f60ff newfile + diff -r 5907cbc074a0 -r 7e8d59a0286a newfile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/newfile Thu Jan 01 00:00:00 1970 +0000 @@ -0,0 +1,1 @@ @@ -413,39 +470,39 @@ () [default] draft $ hg evolve --all --content-divergent - merge:[10] added a - with: [5] watbar to a + merge:[5] watbar to a + with: [10] added a base: [1] added a - rebasing "other" content-divergent changeset 8e222f257bbf on 2228e3b74514 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - merge:[11] added b - with: [6] added b + rebasing "divergent" content-divergent changeset 8e222f257bbf on 2228e3b74514 + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + merge:[6] added b + with: [11] added b base: [2] added b - rebasing "divergent" content-divergent changeset 6eb54b5af3fb on ebb749d2ace8 - rebasing "other" content-divergent changeset d5f148423c16 on ebb749d2ace8 + rebasing "divergent" content-divergent changeset d5f148423c16 on 7e67dfb7ee31 + rebasing "other" content-divergent changeset 6eb54b5af3fb on 7e67dfb7ee31 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - merge:[12] added c - with: [7] added c + merge:[7] added c + with: [12] added c base: [3] added c - rebasing "divergent" content-divergent changeset 8ed612937375 on 9437917ebe8d - rebasing "other" content-divergent changeset 3ce4be6d8e5e on 9437917ebe8d + rebasing "divergent" content-divergent changeset 3ce4be6d8e5e on 80cec1b1c90f + rebasing "other" content-divergent changeset 8ed612937375 on 80cec1b1c90f 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - merge:[13] added d - with: [8] added d + merge:[8] added d + with: [13] added d base: [4] added d - rebasing "divergent" content-divergent changeset d45f050514c2 on 8e574c12775a - rebasing "other" content-divergent changeset c72d2885eb51 on 8e574c12775a + rebasing "divergent" content-divergent changeset c72d2885eb51 on 7e370616fb2b + rebasing "other" content-divergent changeset d45f050514c2 on 7e370616fb2b 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - working directory is now at ebb749d2ace8 + working directory is now at 7e67dfb7ee31 $ hg glog - o 24:5ab9b88fbead added d + o 24:469255caf534 added d | () [default] draft - o 21:8e574c12775a added c + o 21:7e370616fb2b added c | () [default] draft - o 18:9437917ebe8d added b + o 18:80cec1b1c90f added b | () [default] draft - @ 15:ebb749d2ace8 watbar to a + @ 15:7e67dfb7ee31 watbar to a | () [default] draft o 9:2228e3b74514 add newfile | () [default] draft @@ -457,30 +514,43 @@ $ hg strip 14: --hidden 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - saved backup bundle to $TESTTMP/stackrepo1/.hg/strip-backup/ebb749d2ace8-0585ef5a-backup.hg + saved backup bundle to $TESTTMP/stackrepo1/.hg/strip-backup/7e67dfb7ee31-ff5c6a6d-backup.hg 8 new content-divergent changesets Prepare repo to have merge conflicts $ hg up -r "max(desc('added a'))" 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg evolve -r . --content-divergent - merge:[10] added a - with: [5] watbar to a + merge:[5] watbar to a + with: [10] added a base: [1] added a - rebasing "other" content-divergent changeset 8e222f257bbf on 2228e3b74514 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + rebasing "divergent" content-divergent changeset 8e222f257bbf on 2228e3b74514 + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 6 new orphan changesets - working directory is now at ebb749d2ace8 + working directory is now at 7e67dfb7ee31 $ echo b_conflict > b $ hg amend -A adding b Let's try to evolve stack $ hg evolve --content-divergent - merge:[11] added b - with: [6] added b + merge:[6] added b + with: [11] added b base: [2] added b - rebasing "divergent" content-divergent changeset 6eb54b5af3fb on 73a960350ce9 + rebasing "divergent" content-divergent changeset d5f148423c16 on c758af982013 + merging b + warning: conflicts while merging b! (edit, then use 'hg resolve --mark') + unresolved merge conflicts + (see 'hg help evolve.interrupted') + [1] + + $ echo b > b + $ hg res -m + (no more unresolved files) + continue: hg evolve --continue + $ hg evolve --continue + evolving 6:d5f148423c16 "added b" + rebasing "other" content-divergent changeset 6eb54b5af3fb on c758af982013 merging b warning: conflicts while merging b! (edit, then use 'hg resolve --mark') unresolved merge conflicts @@ -493,41 +563,28 @@ continue: hg evolve --continue $ hg evolve --continue evolving 11:6eb54b5af3fb "added b" - rebasing "other" content-divergent changeset d5f148423c16 on 73a960350ce9 - merging b - warning: conflicts while merging b! (edit, then use 'hg resolve --mark') - unresolved merge conflicts - (see 'hg help evolve.interrupted') - [1] - - $ echo b > b - $ hg res -m - (no more unresolved files) - continue: hg evolve --continue - $ hg evolve --continue - evolving 6:d5f148423c16 "added b" 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - merge:[12] added c - with: [7] added c + merge:[7] added c + with: [12] added c base: [3] added c - rebasing "divergent" content-divergent changeset 8ed612937375 on 1b637ec00f24 - rebasing "other" content-divergent changeset 3ce4be6d8e5e on 1b637ec00f24 + rebasing "divergent" content-divergent changeset 3ce4be6d8e5e on 1a79fc84e761 + rebasing "other" content-divergent changeset 8ed612937375 on 1a79fc84e761 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - merge:[13] added d - with: [8] added d + merge:[8] added d + with: [13] added d base: [4] added d - rebasing "divergent" content-divergent changeset d45f050514c2 on fbfadbe143d8 - rebasing "other" content-divergent changeset c72d2885eb51 on fbfadbe143d8 + rebasing "divergent" content-divergent changeset c72d2885eb51 on 6c228f1e5409 + rebasing "other" content-divergent changeset d45f050514c2 on 6c228f1e5409 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - working directory is now at 73a960350ce9 + working directory is now at c758af982013 $ hg glog - o 25:bf2836f524a3 added d + o 25:957008d45543 added d | () [default] draft - o 22:fbfadbe143d8 added c + o 22:6c228f1e5409 added c | () [default] draft - o 19:1b637ec00f24 added b + o 19:1a79fc84e761 added b | () [default] draft - @ 16:73a960350ce9 watbar to a + @ 16:c758af982013 watbar to a | () [default] draft o 9:2228e3b74514 add newfile | () [default] draft @@ -538,7 +595,7 @@ -------------------------------------------------------------- $ hg strip 14: --hidden 0 files updated, 0 files merged, 2 files removed, 0 files unresolved - saved backup bundle to $TESTTMP/stackrepo1/.hg/strip-backup/ebb749d2ace8-c2c1e937-backup.hg + saved backup bundle to $TESTTMP/stackrepo1/.hg/strip-backup/c758af982013-0af4fee9-backup.hg 8 new content-divergent changesets Insert conflicting changes in between the stack of content-div csets @@ -571,16 +628,16 @@ Now let's try to evolve stack $ hg evolve --content-divergent - merge:[10] added a - with: [5] watbar to a + merge:[5] watbar to a + with: [10] added a base: [1] added a - rebasing "other" content-divergent changeset 8e222f257bbf on 2228e3b74514 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + rebasing "divergent" content-divergent changeset 8e222f257bbf on 2228e3b74514 + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved merge:[14] added b with: [17] added b base: [2] added b - rebasing "divergent" content-divergent changeset 2a955e808c53 on ebb749d2ace8 - rebasing "other" content-divergent changeset 509103439e5e on ebb749d2ace8 + rebasing "divergent" content-divergent changeset 2a955e808c53 on 7e67dfb7ee31 + rebasing "other" content-divergent changeset 509103439e5e on 7e67dfb7ee31 merging b warning: conflicts while merging b! (edit, then use 'hg resolve --mark') 0 files updated, 0 files merged, 0 files removed, 1 files unresolved @@ -672,16 +729,16 @@ summary: added hgignore $ hg evolve --content-divergent - merge:[10] added a - with: [5] watbar to a + merge:[5] watbar to a + with: [10] added a base: [1] added a - rebasing "other" content-divergent changeset 8e222f257bbf on 2228e3b74514 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + rebasing "divergent" content-divergent changeset 8e222f257bbf on 2228e3b74514 + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved merge:[14] added b with: [17] added b base: [2] added b - rebasing "divergent" content-divergent changeset 2a955e808c53 on ebb749d2ace8 - rebasing "other" content-divergent changeset 509103439e5e on ebb749d2ace8 + rebasing "divergent" content-divergent changeset 2a955e808c53 on 7e67dfb7ee31 + rebasing "other" content-divergent changeset 509103439e5e on 7e67dfb7ee31 merging b warning: conflicts while merging b! (edit, then use 'hg resolve --mark') 0 files updated, 0 files merged, 0 files removed, 1 files unresolved @@ -695,7 +752,7 @@ stopped the interrupted evolve working directory is now at 2a955e808c53 $ hg log -G - o changeset: 21:ebb749d2ace8 + o changeset: 21:7e67dfb7ee31 | tag: tip | parent: 9:2228e3b74514 | user: test @@ -743,7 +800,7 @@ +---x changeset: 10:c04ff147ef79 | | user: test | | date: Thu Jan 01 00:00:00 1970 +0000 - | | obsolete: rewritten using evolve as 21:ebb749d2ace8 + | | obsolete: rewritten using evolve as 21:7e67dfb7ee31 | | summary: added a | | o | changeset: 9:2228e3b74514 @@ -756,7 +813,7 @@ |/ parent: 0:8fa14d15e168 | user: test | date: Thu Jan 01 00:00:00 1970 +0000 - | obsolete: rebased using evolve as 21:ebb749d2ace8 + | obsolete: rebased using evolve as 21:7e67dfb7ee31 | summary: watbar to a | o changeset: 0:8fa14d15e168 @@ -765,7 +822,7 @@ summary: added hgignore $ hg obslog -r 'desc("watbar to a")' --all - o ebb749d2ace8 (21) watbar to a + o 7e67dfb7ee31 (21) watbar to a |\ rewritten from 186bdc2cdfa2 using evolve by test (Thu Jan 01 00:00:00 1970 +0000) | | rewritten(description, content) from c04ff147ef79 using evolve by test (Thu Jan 01 00:00:00 1970 +0000) | | @@ -801,8 +858,8 @@ merge:[14] added b with: [17] added b base: [2] added b - rebasing "divergent" content-divergent changeset 2a955e808c53 on ebb749d2ace8 - rebasing "other" content-divergent changeset 509103439e5e on ebb749d2ace8 + rebasing "divergent" content-divergent changeset 2a955e808c53 on 7e67dfb7ee31 + rebasing "other" content-divergent changeset 509103439e5e on 7e67dfb7ee31 merging b warning: conflicts while merging b! (edit, then use 'hg resolve --mark') 0 files updated, 0 files merged, 0 files removed, 1 files unresolved @@ -818,16 +875,16 @@ merge:[15] added c with: [18] added c base: [3] added c - rebasing "divergent" content-divergent changeset 48b0f803817a on 32bceb5bc91e - rebasing "other" content-divergent changeset eaf34afe4df3 on 32bceb5bc91e + rebasing "divergent" content-divergent changeset 48b0f803817a on ddfcba2aac91 + rebasing "other" content-divergent changeset eaf34afe4df3 on ddfcba2aac91 0 files updated, 0 files merged, 0 files removed, 0 files unresolved merge:[16] added d with: [19] added d base: [4] added d - rebasing "divergent" content-divergent changeset 91c8ccb9c241 on a87eb9f90df6 - rebasing "other" content-divergent changeset c351be27f199 on a87eb9f90df6 + rebasing "divergent" content-divergent changeset 91c8ccb9c241 on bb396302d792 + rebasing "other" content-divergent changeset c351be27f199 on bb396302d792 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - working directory is now at 32bceb5bc91e + working directory is now at ddfcba2aac91 $ hg evolve -l @@ -954,16 +1011,16 @@ $ hg evolve --content-divergent - merge:[6] b - with: [3] b + merge:[3] b + with: [6] b base: [1] b - rebasing "other" content-divergent changeset 5b2d00df9c4e on 980f7dc84c29 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - merge:[7] c - with: [4] c + rebasing "divergent" content-divergent changeset 5b2d00df9c4e on 980f7dc84c29 + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + merge:[4] c + with: [7] c base: [2] c - rebasing "divergent" content-divergent changeset ef4885dea3da on 6813d99f0a9d - rebasing "other" content-divergent changeset fef59171875e on 6813d99f0a9d + rebasing "divergent" content-divergent changeset fef59171875e on bfba946a2829 + rebasing "other" content-divergent changeset ef4885dea3da on bfba946a2829 0 files updated, 0 files merged, 0 files removed, 0 files unresolved Expected result: @@ -971,15 +1028,15 @@ Changeset with description "c" only adds file "c" with content "c". $ hg glog -l2 -p - o 12:d5a8159e883f c - | () [default] draftdiff -r 6813d99f0a9d -r d5a8159e883f c + o 12:a5abd6c7f9d8 c + | () [default] draftdiff -r bfba946a2829 -r a5abd6c7f9d8 c | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | +++ b/c Thu Jan 01 00:00:00 1970 +0000 | @@ -0,0 +1,1 @@ | +c | - o 9:6813d99f0a9d b - | () [default] draftdiff -r 980f7dc84c29 -r 6813d99f0a9d b + o 9:bfba946a2829 b + | () [default] draftdiff -r 980f7dc84c29 -r bfba946a2829 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 @@ @@ -1057,24 +1114,24 @@ () [default] draft $ hg evolve -r 4+5 --content-divergent - merge:[8] added foo - with: [4] added foo + merge:[4] added foo + with: [8] added foo base: [1] added foo - rebasing "other" content-divergent changeset 8a2d93492f59 on 9703820a7d5b - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - merge:[9] added bar and car - with: [5] added bar and car + rebasing "divergent" content-divergent changeset 8a2d93492f59 on 9703820a7d5b + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + merge:[5] added bar and car + with: [9] added bar and car base: [2] added bar and car - rebasing "divergent" content-divergent changeset 7dd5b9d42ef3 on 586526ab82c5 - rebasing "other" content-divergent changeset f4ed107810a7 on 586526ab82c5 + rebasing "divergent" content-divergent changeset f4ed107810a7 on 3e0693d8f69b + rebasing "other" content-divergent changeset 7dd5b9d42ef3 on 3e0693d8f69b 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 2 new orphan changesets - working directory is now at 586526ab82c5 + working directory is now at 3e0693d8f69b $ hg glog - o 15:e905bb19fd7e added bar and car + o 15:5382795441b8 added bar and car | () [default] draft - @ 12:586526ab82c5 added foo + @ 12:3e0693d8f69b added foo | () [default] draft | * 10:9a1f460df8b5 added dar | | () [default] draft