comparison tests/test-evolve-content-divergent-case-A4.t @ 5392:5c08b3bec031

evolve: add test for content-div case A4
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Sat, 20 Jun 2020 11:24:14 +0530
parents
children d7d954b6d518
comparison
equal deleted inserted replaced
5391:29366c95306d 5392:5c08b3bec031
1 ===============================================
2 Testing content-divergence resolution: Case A.4
3 ===============================================
4
5 Independent rewrites of same changeset can lead to content-divergence. In most
6 common cases, it can occur when multiple users rewrite the same changeset
7 independently and push it.
8
9 This test belongs to a series of tests checking the resolution of content-divergent
10 changesets.
11
12 Category A: no parents are obsolete
13 Testcase 4: both sides relocated forward to different location but aligned
14 Variants:
15 # a: local is ahead of other
16 # b: other is ahead of local
17
18 A.4 Both relocated forward
19 ==========================
20
21 .. (Divergence reason):
22 .. local: relocated the changeset forward in the graph but on the same topo branch
23 .. other: relocated the changeset forward in the graph but on the same topo branch
24 .. Where we show that since both changesets relocated forward in the graph,
25 .. we can assume the reason for ahead one being ahead is that it's rebased on the latest changes and
26 .. its parent should be the resolution parent. So, we will relocate the other changeset to resolution
27 .. parent and perform 3-way merge.
28 ..
29 .. (local):
30 ..
31 .. D ø⇠○ D'
32 .. | |
33 .. | ○ C
34 .. | |
35 .. | ○ B
36 .. \ |
37 .. ○ A
38 .. |
39 .. ● O
40 ..
41 .. (other):
42 ..
43 .. D ø⇠○ D''
44 .. | | ○ C
45 .. | | /
46 .. | ○ B
47 .. \ |
48 .. ○ A
49 .. |
50 .. ● O
51 ..
52 .. (Resolution):
53 .. ○ D'''
54 .. |
55 .. ○ C
56 .. |
57 .. ○ B
58 .. |
59 .. ○ A
60 .. |
61 .. ● O
62 ..
63
64 Setup
65 -----
66 $ . $TESTDIR/testlib/content-divergence-util.sh
67 $ setuprepos A.4
68 creating test repo for test case A.4
69 - upstream
70 - local
71 - other
72 cd into `local` and proceed with env setup
73
74 initial
75
76 $ cd upstream
77 $ mkcommit A
78 $ mkcommit B
79 $ mkcommit C
80 $ hg co -r 'desc(A)'
81 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
82 $ mkcommit D
83 created new head
84 $ cd ../local
85 $ hg pull -qu
86 $ hg rebase -r 'desc(D)' -d 'desc(C)'
87 rebasing 4:6a418860e87b "D" (tip)
88
89 $ cd ../other
90 $ hg pull -qu
91 $ hg rebase -r 'desc(D)' -d 'desc(B)'
92 rebasing 4:6a418860e87b "D" (tip)
93 $ hg push -q
94
95 $ cd ../local
96 $ hg push -q
97 2 new content-divergent changesets
98 $ hg pull -q
99 2 new content-divergent changesets
100
101 Actual test of resolution
102 -------------------------
103
104 Variant_a: when local is ahead of other
105 ---------------------------------------
106
107 $ hg evolve -l
108 d203ddccc9cc: D
109 content-divergent: 5d3fd66cb347 (draft) (precursor 6a418860e87b)
110
111 5d3fd66cb347: D
112 content-divergent: d203ddccc9cc (draft) (precursor 6a418860e87b)
113
114 $ hg log -G --hidden
115 * 6:5d3fd66cb347 (draft): D [content-divergent]
116 |
117 | @ 5:d203ddccc9cc (draft): D [content-divergent]
118 | |
119 | | x 4:6a418860e87b (draft): D
120 | | |
121 | o | 3:d90aa47aa5d3 (draft): C
122 |/ /
123 o / 2:f6fbb35d8ac9 (draft): B
124 |/
125 o 1:f5bc6836db60 (draft): A
126 |
127 o 0:a9bdc8b26820 (public): O
128
129 $ hg evolve --content-divergent
130 merge:[5] D
131 with: [6] D
132 base: [4] D
133 rebasing "other" content-divergent changeset 5d3fd66cb347 on d90aa47aa5d3
134 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
135 working directory is now at 898f6bbfb21e
136
137 $ hg log -G
138 @ 8:898f6bbfb21e (draft): D
139 |
140 o 3:d90aa47aa5d3 (draft): C
141 |
142 o 2:f6fbb35d8ac9 (draft): B
143 |
144 o 1:f5bc6836db60 (draft): A
145 |
146 o 0:a9bdc8b26820 (public): O
147
148 $ hg evolve -l
149
150 Variant_b: when other is ahead of local
151 ---------------------------------------
152
153 $ cd ../other
154 $ hg pull -q
155 2 new content-divergent changesets
156
157 $ hg evolve -l
158 5d3fd66cb347: D
159 content-divergent: d203ddccc9cc (draft) (precursor 6a418860e87b)
160
161 d203ddccc9cc: D
162 content-divergent: 5d3fd66cb347 (draft) (precursor 6a418860e87b)
163
164 $ hg log -G --hidden
165 * 6:d203ddccc9cc (draft): D [content-divergent]
166 |
167 | @ 5:5d3fd66cb347 (draft): D [content-divergent]
168 | |
169 | | x 4:6a418860e87b (draft): D
170 | | |
171 o | | 3:d90aa47aa5d3 (draft): C
172 |/ /
173 o / 2:f6fbb35d8ac9 (draft): B
174 |/
175 o 1:f5bc6836db60 (draft): A
176 |
177 o 0:a9bdc8b26820 (public): O
178
179 $ hg evolve --content-divergent
180 merge:[6] D
181 with: [5] D
182 base: [4] D
183 rebasing "other" content-divergent changeset 5d3fd66cb347 on d90aa47aa5d3
184 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
185 working directory is now at 898f6bbfb21e
186
187 $ hg log -G
188 @ 8:898f6bbfb21e (draft): D
189 |
190 o 3:d90aa47aa5d3 (draft): C
191 |
192 o 2:f6fbb35d8ac9 (draft): B
193 |
194 o 1:f5bc6836db60 (draft): A
195 |
196 o 0:a9bdc8b26820 (public): O
197