|
1 ======================================================== |
|
2 Tests the resolution of content divergence: corner cases |
|
3 ======================================================== |
|
4 |
|
5 This file intend to cover cases that are specific enough to not fit in the |
|
6 other cases. |
|
7 |
|
8 $ cat >> $HGRCPATH <<EOF |
|
9 > [alias] |
|
10 > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) [{branch}] {phase}" |
|
11 > [defaults] |
|
12 > amend=-d "0 0" |
|
13 > fold=-d "0 0" |
|
14 > [web] |
|
15 > push_ssl = false |
|
16 > allow_push = * |
|
17 > [phases] |
|
18 > publish = False |
|
19 > [diff] |
|
20 > git = 1 |
|
21 > unified = 0 |
|
22 > [ui] |
|
23 > logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline} [{troubles}]\n |
|
24 > [extensions] |
|
25 > EOF |
|
26 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH |
|
27 $ mkcommit() { |
|
28 > echo "$1" > "$1" |
|
29 > hg add "$1" |
|
30 > hg ci -m "add $1" |
|
31 > } |
|
32 |
|
33 $ mkcommits() { |
|
34 > for i in $@; do mkcommit $i ; done |
|
35 > } |
|
36 |
|
37 Basic test of divergence: two divergent changesets with the same parents |
|
38 With --all --any we dedupe the divergent and solve the divergence once |
|
39 |
|
40 $ hg init test1 |
|
41 $ cd test1 |
|
42 $ echo a > a |
|
43 $ hg ci -Aqm "added a" |
|
44 $ echo b > b |
|
45 $ hg ci -Aqm "added b" |
|
46 |
|
47 $ hg up .^ |
|
48 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
49 $ echo bdivergent > bdivergent1 |
|
50 $ hg ci -Am "divergent" |
|
51 adding bdivergent1 |
|
52 created new head |
|
53 |
|
54 $ hg up .^ |
|
55 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
56 $ echo bdivergent > bdivergent2 |
|
57 $ hg ci -Am "divergent" |
|
58 adding bdivergent2 |
|
59 created new head |
|
60 |
|
61 $ hg prune -s 8374d2ddc3a4 "desc('added b')" |
|
62 1 changesets pruned |
|
63 $ hg prune -s 593c57f2117e "desc('added b')" --hidden |
|
64 1 changesets pruned |
|
65 2 new content-divergent changesets |
|
66 |
|
67 $ hg log -G |
|
68 @ 3:8374d2ddc3a4@default(draft) divergent [content-divergent] |
|
69 | |
|
70 | * 2:593c57f2117e@default(draft) divergent [content-divergent] |
|
71 |/ |
|
72 o 0:9092f1db7931@default(draft) added a [] |
|
73 |
|
74 |
|
75 $ hg evolve --all --any --content-divergent |
|
76 merge:[2] divergent |
|
77 with: [3] divergent |
|
78 base: [1] added b |
|
79 updating to "local" side of the conflict: 593c57f2117e |
|
80 merging "other" content-divergent changeset '8374d2ddc3a4' |
|
81 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
82 working directory is now at 45bf1312f454 |
|
83 $ hg log -G |
|
84 @ 4:45bf1312f454@default(draft) divergent [] |
|
85 | |
|
86 o 0:9092f1db7931@default(draft) added a [] |
|
87 |
|
88 Test divergence resolution when it yields to an empty commit (issue4950) |
|
89 cdivergent2 contains the same content than cdivergent1 and they are divergent |
|
90 versions of the revision _c |
|
91 |
|
92 $ hg up .^ |
|
93 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
94 $ mkcommit _c |
|
95 created new head |
|
96 |
|
97 $ hg up .^ |
|
98 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
99 $ mkcommit cdivergent1 |
|
100 created new head |
|
101 |
|
102 $ hg up .^ |
|
103 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
104 $ echo "cdivergent1" > cdivergent1 |
|
105 $ hg add cdivergent1 |
|
106 $ hg ci -m "add _c" |
|
107 created new head |
|
108 |
|
109 $ hg log -G |
|
110 @ 7:b2ae71172042@default(draft) add _c [] |
|
111 | |
|
112 | o 6:e3ff64ce8d4c@default(draft) add cdivergent1 [] |
|
113 |/ |
|
114 | o 5:48819a835615@default(draft) add _c [] |
|
115 |/ |
|
116 | o 4:45bf1312f454@default(draft) divergent [] |
|
117 |/ |
|
118 o 0:9092f1db7931@default(draft) added a [] |
|
119 |
|
120 |
|
121 $ hg prune -s b2ae71172042 48819a835615 |
|
122 1 changesets pruned |
|
123 $ hg prune -s e3ff64ce8d4c 48819a835615 --hidden |
|
124 1 changesets pruned |
|
125 2 new content-divergent changesets |
|
126 |
|
127 $ hg log -G |
|
128 @ 7:b2ae71172042@default(draft) add _c [content-divergent] |
|
129 | |
|
130 | * 6:e3ff64ce8d4c@default(draft) add cdivergent1 [content-divergent] |
|
131 |/ |
|
132 | o 4:45bf1312f454@default(draft) divergent [] |
|
133 |/ |
|
134 o 0:9092f1db7931@default(draft) added a [] |
|
135 |
|
136 $ hg evolve --all --any --content-divergent |
|
137 merge:[6] add cdivergent1 |
|
138 with: [7] add _c |
|
139 base: [5] add _c |
|
140 updating to "local" side of the conflict: e3ff64ce8d4c |
|
141 merging "other" content-divergent changeset 'b2ae71172042' |
|
142 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
143 nothing changed |
|
144 working directory is now at e3ff64ce8d4c |
|
145 |
|
146 $ cd .. |
|
147 |
|
148 Test None docstring issue of evolve divergent, which caused hg crush |
|
149 |
|
150 $ hg init test2 |
|
151 $ cd test2 |
|
152 $ mkcommits _a _b |
|
153 |
|
154 $ hg up .^ |
|
155 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
156 $ echo bdivergent > bdivergent11 |
|
157 $ hg ci -Am "bdivergent" |
|
158 adding bdivergent11 |
|
159 created new head |
|
160 |
|
161 $ hg up .^ |
|
162 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
163 $ echo bdivergent > bdivergent22 |
|
164 $ hg ci -Am "bdivergent" |
|
165 adding bdivergent22 |
|
166 created new head |
|
167 |
|
168 $ hg log -G |
|
169 @ 3:6b096fb45070@default(draft) bdivergent [] |
|
170 | |
|
171 | o 2:05a6b6a9e633@default(draft) bdivergent [] |
|
172 |/ |
|
173 | o 1:37445b16603b@default(draft) add _b [] |
|
174 |/ |
|
175 o 0:135f39f4bd78@default(draft) add _a [] |
|
176 |
|
177 |
|
178 $ hg prune -s 6b096fb45070 37445b16603b |
|
179 1 changesets pruned |
|
180 $ hg prune -s 05a6b6a9e633 37445b16603b --hidden |
|
181 1 changesets pruned |
|
182 2 new content-divergent changesets |
|
183 $ hg log -G |
|
184 @ 3:6b096fb45070@default(draft) bdivergent [content-divergent] |
|
185 | |
|
186 | * 2:05a6b6a9e633@default(draft) bdivergent [content-divergent] |
|
187 |/ |
|
188 o 0:135f39f4bd78@default(draft) add _a [] |
|
189 |
|
190 |
|
191 $ cat >$TESTTMP/test_extension.py << EOF |
|
192 > from mercurial import merge |
|
193 > origupdate = merge.update |
|
194 > def newupdate(*args, **kwargs): |
|
195 > return origupdate(*args, **kwargs) |
|
196 > merge.update = newupdate |
|
197 > EOF |
|
198 $ cat >> $HGRCPATH << EOF |
|
199 > [extensions] |
|
200 > testextension=$TESTTMP/test_extension.py |
|
201 > EOF |
|
202 $ hg evolve --all |
|
203 nothing to evolve on current working copy parent |
|
204 (do you want to use --content-divergent) |
|
205 [2] |
|
206 $ hg evolve --content-divergent |
|
207 merge:[3] bdivergent |
|
208 with: [2] bdivergent |
|
209 base: [1] add _b |
|
210 merging "other" content-divergent changeset '05a6b6a9e633' |
|
211 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
212 working directory is now at 73ff357d3975 |
|
213 |
|
214 $ cd .. |
|
215 |
|
216 Test to make sure that evolve don't fall into unrecoverable state (issue6053) |
|
217 ------------------------------------------------------------------------------ |
|
218 |
|
219 It happened when two divergent csets has different parent (need relocation) |
|
220 and resolution parent is obsolete. So this issue triggered when during |
|
221 relocation we hit conflicts. So lets make the repo as described. |
|
222 |
|
223 $ hg init localside |
|
224 $ cd localside |
|
225 $ for ch in a b c d e; do |
|
226 > echo $ch > $ch; |
|
227 > hg add $ch; |
|
228 > hg ci -m "added "$ch; |
|
229 > done; |
|
230 |
|
231 $ hg glog |
|
232 @ 4:8d71eadcc9df added e |
|
233 | () [default] draft |
|
234 o 3:9150fe93bec6 added d |
|
235 | () [default] draft |
|
236 o 2:155349b645be added c |
|
237 | () [default] draft |
|
238 o 1:5f6d8a4bf34a added b |
|
239 | () [default] draft |
|
240 o 0:9092f1db7931 added a |
|
241 () [default] draft |
|
242 |
|
243 $ echo ee > e |
|
244 $ hg amend -m "updated e" |
|
245 $ hg up 1 -q |
|
246 |
|
247 To make sure we hit conflict while relocating |
|
248 $ echo dd > d |
|
249 $ echo ee > e |
|
250 $ hg add d e |
|
251 $ hg ci -m "updated e" |
|
252 created new head |
|
253 |
|
254 Lets create divergence |
|
255 $ hg prune 4 -s . --hidden |
|
256 1 changesets pruned |
|
257 2 new content-divergent changesets |
|
258 |
|
259 Making obsolete resolution parent |
|
260 $ hg prune 3 |
|
261 1 changesets pruned |
|
262 1 new orphan changesets |
|
263 |
|
264 $ hg glog |
|
265 @ 6:de4ea3103326 updated e |
|
266 | () [default] draft |
|
267 | * 5:ff6f7cd76a7c updated e |
|
268 | | () [default] draft |
|
269 | x 3:9150fe93bec6 added d |
|
270 | | () [default] draft |
|
271 | o 2:155349b645be added c |
|
272 |/ () [default] draft |
|
273 o 1:5f6d8a4bf34a added b |
|
274 | () [default] draft |
|
275 o 0:9092f1db7931 added a |
|
276 () [default] draft |
|
277 |
|
278 $ hg evolve --content-divergent --any |
|
279 merge:[5] updated e |
|
280 with: [6] updated e |
|
281 base: [4] added e |
|
282 rebasing "other" content-divergent changeset de4ea3103326 on 9150fe93bec6 |
|
283 merging d |
|
284 warning: conflicts while merging d! (edit, then use 'hg resolve --mark') |
|
285 fix conflicts and see `hg help evolve.interrupted` |
|
286 [1] |
|
287 |
|
288 $ hg diff --no-git --config diff.unified=3 |
|
289 diff -r 9150fe93bec6 d |
|
290 --- a/d Thu Jan 01 00:00:00 1970 +0000 |
|
291 +++ b/d Thu Jan 01 00:00:00 1970 +0000 |
|
292 @@ -1,1 +1,5 @@ |
|
293 +<<<<<<< destination: 9150fe93bec6 - test: added d |
|
294 d |
|
295 +======= |
|
296 +dd |
|
297 +>>>>>>> evolving: de4ea3103326 - test: updated e |
|
298 diff -r 9150fe93bec6 e |
|
299 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
300 +++ b/e Thu Jan 01 00:00:00 1970 +0000 |
|
301 @@ -0,0 +1,1 @@ |
|
302 +ee |
|
303 |
|
304 $ echo dresolved > d |
|
305 $ hg res -m |
|
306 (no more unresolved files) |
|
307 continue: hg evolve --continue |
|
308 |
|
309 $ hg evolve --continue |
|
310 evolving 6:de4ea3103326 "updated e" |
|
311 updating to "local" side of the conflict: ff6f7cd76a7c |
|
312 merging "other" content-divergent changeset 'e504bd82de7e' |
|
313 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
314 working directory is now at 83b1664a580f |
|
315 |
|
316 $ hg glog -l1 |
|
317 @ 8:83b1664a580f updated e |
|
318 | () [default] draft |
|
319 ~ |
|
320 |
|
321 $ cd .. |