Commit 2c0d5622 authored by Sushil Khanchi's avatar Sushil Khanchi 🐨
Browse files

evolve: add test for content-div where one div cset rebased backward

This patch adds a test coverage for the resolution of a case where one
side amended some content changes and other side moved backward and
created content-divergence.
parent 1f111a3c09fe
Pipeline #13473 passed with stage
in 7 minutes and 36 seconds
===============================================
Testing content-divergence resolution: Case A.5
===============================================
Independent rewrites of same changeset can lead to content-divergence. In most
common cases, it can occur when multiple users rewrite the same changeset
independently and push it.
This test belongs to a series of tests checking the resolution of content-divergent
changesets.
Category A: no parents are obsolete
Testcase 5: one side relocated backward and other amended content changes
Variants:
# a: "local" is rebased backward
# b: "other" is rebased backward
A.5 Relocated backward; Amended content changes
===============================================
.. (Divergence reason):
.. local: relocated the changeset backward in the graph
.. other: amended some content changes
.. Where we show that since one side amended some changes and other just relocated,
.. the most reasonable behaviour is to relocate the amended one to the same parent as
.. relocated one and perform 3-way merge.
..
.. (local):
..
.. C ø⇠○ C'
.. | |
.. B ○ |
.. | /
.. A ○
.. |
.. O ●
..
.. (other):
..
.. C ø⇠○ C''
.. | |
.. | /
.. B ○
.. |
.. A ○
.. |
.. O ●
..
.. (Resolution):
..
.. ○ C'''
.. B /
.. |/
.. A
.. |
.. O
..
Setup
-----
$ . $TESTDIR/testlib/content-divergence-util.sh
$ setuprepos A.5
creating test repo for test case A.5
- upstream
- local
- other
cd into `local` and proceed with env setup
initial
$ cd upstream
$ mkcommit A
$ mkcommit B
$ mkcommit C
$ cd ../local
$ hg pull -qu
$ hg rebase -r 'desc(C)' -d 'desc(A)'
rebasing 3:d90aa47aa5d3 tip "C"
$ cd ../other
$ hg pull -qu
$ echo newC > C
$ hg amend
$ hg push -q
$ cd ../local
$ hg push -fq
2 new content-divergent changesets
$ hg pull -q
2 new content-divergent changesets
Actual test of resolution
-------------------------
Variant_a: when "local" is rebased backward
-------------------------------------------
$ hg evolve -l
b80b2bbeb664: C
content-divergent: 54d70f6c4363 (draft) (precursor d90aa47aa5d3)
54d70f6c4363: C
content-divergent: b80b2bbeb664 (draft) (precursor d90aa47aa5d3)
$ hg log -G --hidden
* 5:54d70f6c4363 (draft): C [content-divergent]
|
| @ 4:b80b2bbeb664 (draft): C [content-divergent]
| |
+---x 3:d90aa47aa5d3 (draft): C
| |
o | 2:f6fbb35d8ac9 (draft): B
|/
o 1:f5bc6836db60 (draft): A
|
o 0:a9bdc8b26820 (public): O
$ hg evolve --content-divergent
merge:[4] C
with: [5] C
base: [3] C
rebasing "other" content-divergent changeset 54d70f6c4363 on f5bc6836db60
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
working directory is now at 610642285961
$ hg log -G
@ 7:610642285961 (draft): C
|
| o 2:f6fbb35d8ac9 (draft): B
|/
o 1:f5bc6836db60 (draft): A
|
o 0:a9bdc8b26820 (public): O
$ hg evolve -l
$ hg log -pl1
7:610642285961 (draft): C
diff -r f5bc6836db60 -r 610642285961 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 @@
+newC
Variant_b: when "other" is rebased backward
-------------------------------------------
$ cd ../other
$ hg pull -q
2 new content-divergent changesets
$ hg evolve -l
54d70f6c4363: C
content-divergent: b80b2bbeb664 (draft) (precursor d90aa47aa5d3)
b80b2bbeb664: C
content-divergent: 54d70f6c4363 (draft) (precursor d90aa47aa5d3)
$ hg log -G --hidden
* 5:b80b2bbeb664 (draft): C [content-divergent]
|
| @ 4:54d70f6c4363 (draft): C [content-divergent]
| |
| | x 3:d90aa47aa5d3 (draft): C
| |/
| o 2:f6fbb35d8ac9 (draft): B
|/
o 1:f5bc6836db60 (draft): A
|
o 0:a9bdc8b26820 (public): O
$ hg evolve --content-divergent
merge:[4] C
with: [5] C
base: [3] C
rebasing "divergent" content-divergent changeset 54d70f6c4363 on f5bc6836db60
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
working directory is now at 1ea50c505b60
$ hg log -G
@ 7:1ea50c505b60 (draft): C
|
| o 2:f6fbb35d8ac9 (draft): B
|/
o 1:f5bc6836db60 (draft): A
|
o 0:a9bdc8b26820 (public): O
$ hg evolve -l
$ hg log -pl1
7:1ea50c505b60 (draft): C
diff -r f5bc6836db60 -r 1ea50c505b60 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 @@
+newC
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment