comparison tests/test-unstability-resolution-result.t @ 4470:046dd7718845

test: apply unstability resolution to `test-unstability-resolution-result.t` The test cases in this file probably deserved to be dispatched in other more thematic test file.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 04 Apr 2019 12:24:28 +0200
parents tests/test-stabilize-result.t@f530850c8184
children 7a5c6109ee84
comparison
equal deleted inserted replaced
4469:be2614d257ca 4470:046dd7718845
1 =================================================================
2 Test automatic unstability resolution for multiple advanced cases
3 =================================================================
4
5 There are dedicated test case for each instability, but this file check some
6 basic case for each type.
7
8 XXX dispatching each these test case in appropriate file would make sense.
9
10 $ cat >> $HGRCPATH <<EOF
11 > [defaults]
12 > amend=-d "0 0"
13 > [extensions]
14 > hgext.rebase=
15 > EOF
16 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
17
18 $ glog() {
19 > hg log -G --template \
20 > '{rev}:{node|short}@{branch}({phase}) bk:[{bookmarks}] {desc|firstline}\n' "$@"
21 > }
22
23 Test evolve removing the orphan changeset being evolved
24
25 $ hg init empty
26 $ cd empty
27 $ echo a > a
28 $ hg ci -Am adda a
29 $ echo b > b
30 $ hg ci -Am addb b
31 $ echo a >> a
32 $ hg ci -m changea
33 $ hg bookmark changea
34 $ hg up 1
35 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 (leaving bookmark changea)
37 $ echo a >> a
38 $ hg amend -m changea
39 1 new orphan changesets
40 $ hg evolve -v --confirm
41 move:[2] changea
42 atop:[3] changea
43 perform evolve? [Ny] n
44 abort: evolve aborted by user
45 [255]
46 $ echo y | hg evolve -v --confirm --config ui.interactive=True
47 move:[2] changea
48 atop:[3] changea
49 perform evolve? [Ny] y
50 hg rebase -r cce2c55b8965 -d fb9d051ec0a4
51 resolving manifests
52 evolution of 2:cce2c55b8965 created no changes to commit
53
54 $ glog --hidden
55 @ 3:fb9d051ec0a4@default(draft) bk:[changea] changea
56 |
57 | x 2:cce2c55b8965@default(draft) bk:[] changea
58 | |
59 | x 1:102a90ea7b4a@default(draft) bk:[] addb
60 |/
61 o 0:07f494440405@default(draft) bk:[] adda
62
63 $ hg debugobsolete
64 102a90ea7b4a3361e4082ed620918c261189a36a fb9d051ec0a450a4aa2ffc8c324979832ef88065 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'amend', 'user': 'test'}
65 cce2c55b896511e0b6e04173c9450ba822ebc740 0 {102a90ea7b4a3361e4082ed620918c261189a36a} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'evolve', 'user': 'test'}
66
67 Test evolve of orphan that run into conflict
68
69 $ ls
70 a
71 b
72 $ hg pdiff a
73 diff -r 07f494440405 a
74 --- a/a Thu Jan 01 00:00:00 1970 +0000
75 +++ b/a Thu Jan 01 00:00:00 1970 +0000
76 @@ -1,1 +1,2 @@
77 a
78 +a
79 $ echo 'newer a' >> a
80 $ hg ci -m 'newer a'
81 $ hg gdown
82 gdown have been deprecated in favor of previous
83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 [3] changea
85 $ echo 'a' > a
86 $ hg amend
87 1 new orphan changesets
88 $ hg evolve
89 move:[4] newer a
90 atop:[5] changea
91 merging a
92 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
93 fix conflicts and see `hg help evolve.interrupted`
94 [1]
95 $ hg revert -r "orphan()" a
96 $ hg diff
97 diff -r 66719795a494 a
98 --- a/a Thu Jan 01 00:00:00 1970 +0000
99 +++ b/a Thu Jan 01 00:00:00 1970 +0000
100 @@ -1,1 +1,3 @@
101 a
102 +a
103 +newer a
104 $ hg evolve --continue
105 abort: unresolved merge conflicts (see 'hg help resolve')
106 [255]
107 $ hg resolve -m a
108 (no more unresolved files)
109 continue: hg evolve --continue
110 $ hg evolve --continue
111 evolving 4:3655f0f50885 "newer a"
112 working directory is now at 1cf0aacfd363
113
114 Stabilize phase-divergent changesets with a different parent
115 ============================================================
116
117 (the same-parent case is handled in test-evolve.t)
118
119 $ glog
120 @ 6:1cf0aacfd363@default(draft) bk:[] newer a
121 |
122 o 5:66719795a494@default(draft) bk:[changea] changea
123 |
124 o 0:07f494440405@default(draft) bk:[] adda
125
126
127 Add another commit
128
129 $ hg gdown
130 gdown have been deprecated in favor of previous
131 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
132 [5] changea
133 $ echo 'c' > c
134 $ hg add c
135 $ hg commit -m 'add c'
136 created new head
137
138 Get a successors of 8 on it
139
140 $ hg pick 1cf0aacfd363
141 picking 6:1cf0aacfd363 "newer a"
142
143 Add real change to the successors
144
145 $ echo 'babar' >> a
146 $ hg amend
147
148 Make precursors public
149
150 $ hg phase --hidden --public 1cf0aacfd363
151 1 new phase-divergent changesets
152 $ glog
153 @ 9:99c21c89bcef@default(draft) bk:[] newer a
154 |
155 o 7:7bc2f5967f5e@default(draft) bk:[] add c
156 |
157 | o 6:1cf0aacfd363@default(public) bk:[] newer a
158 |/
159 o 5:66719795a494@default(public) bk:[changea] changea
160 |
161 o 0:07f494440405@default(public) bk:[] adda
162
163
164 Stabilize!
165
166 $ hg evolve --any --dry-run --phase-divergent
167 recreate:[9] newer a
168 atop:[6] newer a
169 hg rebase --rev 99c21c89bcef --dest 66719795a494;
170 hg update 1cf0aacfd363;
171 hg revert --all --rev 99c21c89bcef;
172 hg commit --msg "phase-divergent update to 99c21c89bcef"
173 $ hg evolve --any --confirm --phase-divergent
174 recreate:[9] newer a
175 atop:[6] newer a
176 perform evolve? [Ny] n
177 abort: evolve aborted by user
178 [255]
179 $ echo y | hg evolve --any --confirm --config ui.interactive=True --phase-divergent
180 recreate:[9] newer a
181 atop:[6] newer a
182 perform evolve? [Ny] y
183 rebasing to destination parent: 66719795a494
184 committed as 8fc63fe1f297
185 working directory is now at 8fc63fe1f297
186 $ glog
187 @ 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
188 |
189 | o 7:7bc2f5967f5e@default(draft) bk:[] add c
190 | |
191 o | 6:1cf0aacfd363@default(public) bk:[] newer a
192 |/
193 o 5:66719795a494@default(public) bk:[changea] changea
194 |
195 o 0:07f494440405@default(public) bk:[] adda
196
197 $ hg exp
198 # HG changeset patch
199 # User test
200 # Date 0 0
201 # Thu Jan 01 00:00:00 1970 +0000
202 # Node ID 8fc63fe1f297f356d1156bbbbe865b9911efad74
203 # Parent 1cf0aacfd36310b18e403e1594871187e0364a82
204 phase-divergent update to 1cf0aacfd363:
205
206 newer a
207
208 diff -r 1cf0aacfd363 -r 8fc63fe1f297 a
209 --- a/a Thu Jan 01 00:00:00 1970 +0000
210 +++ b/a Thu Jan 01 00:00:00 1970 +0000
211 @@ -1,3 +1,4 @@
212 a
213 a
214 newer a
215 +babar
216
217 Stabilize content-divergent changesets with same parent
218 =======================================================
219
220 $ rm a.orig
221 $ hg up 7bc2f5967f5e
222 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 $ cat << EOF >> a
224 > flore
225 > arthur
226 > zephir
227 > some
228 > less
229 > conflict
230 > EOF
231 $ hg ci -m 'More addition'
232 $ glog
233 @ 12:3932c176bbaa@default(draft) bk:[] More addition
234 |
235 | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
236 | |
237 o | 7:7bc2f5967f5e@default(draft) bk:[] add c
238 | |
239 | o 6:1cf0aacfd363@default(public) bk:[] newer a
240 |/
241 o 5:66719795a494@default(public) bk:[changea] changea
242 |
243 o 0:07f494440405@default(public) bk:[] adda
244
245 $ echo 'babar' >> a
246 $ hg amend
247 $ hg up --hidden 3932c176bbaa
248 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
249 updated to hidden changeset 3932c176bbaa
250 (hidden revision '3932c176bbaa' was rewritten as: d2f173e25686)
251 working directory parent is obsolete! (3932c176bbaa)
252 (use 'hg evolve' to update to its successor: d2f173e25686)
253 $ mv a a.old
254 $ echo 'jungle' > a
255 $ cat a.old >> a
256 $ rm a.old
257 $ hg amend
258 2 new content-divergent changesets
259 $ glog
260 @ 14:eacc9c8240fe@default(draft) bk:[] More addition
261 |
262 | * 13:d2f173e25686@default(draft) bk:[] More addition
263 |/
264 | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
265 | |
266 o | 7:7bc2f5967f5e@default(draft) bk:[] add c
267 | |
268 | o 6:1cf0aacfd363@default(public) bk:[] newer a
269 |/
270 o 5:66719795a494@default(public) bk:[changea] changea
271 |
272 o 0:07f494440405@default(public) bk:[] adda
273
274
275 Stabilize it
276
277 $ hg evolve -qn --confirm --content-divergent
278 merge:[14] More addition
279 with: [13] More addition
280 base: [12] More addition
281 perform evolve? [Ny] n
282 abort: evolve aborted by user
283 [255]
284 $ echo y | hg evolve -qn --confirm --config ui.interactive=True --content-divergent
285 merge:[14] More addition
286 with: [13] More addition
287 base: [12] More addition
288 perform evolve? [Ny] y
289 hg update -c eacc9c8240fe &&
290 hg merge d2f173e25686 &&
291 hg commit -m "auto merge resolving conflict between eacc9c8240fe and d2f173e25686"&&
292 hg up -C 3932c176bbaa &&
293 hg revert --all --rev tip &&
294 hg commit -m "`hg log -r eacc9c8240fe --template={desc}`";
295 $ hg evolve -v --content-divergent
296 merge:[14] More addition
297 with: [13] More addition
298 base: [12] More addition
299 merging "other" content-divergent changeset 'd2f173e25686'
300 resolving manifests
301 merging a
302 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
303 committing files:
304 a
305 committing manifest
306 committing changelog
307 working directory is now at 4d6ed26797bc
308 $ hg st
309 $ glog
310 @ 15:4d6ed26797bc@default(draft) bk:[] More addition
311 |
312 | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
313 | |
314 o | 7:7bc2f5967f5e@default(draft) bk:[] add c
315 | |
316 | o 6:1cf0aacfd363@default(public) bk:[] newer a
317 |/
318 o 5:66719795a494@default(public) bk:[changea] changea
319 |
320 o 0:07f494440405@default(public) bk:[] adda
321
322 $ hg summary
323 parent: 15:4d6ed26797bc tip
324 More addition
325 branch: default
326 commit: (clean)
327 update: 2 new changesets, 2 branch heads (merge)
328 phases: 3 draft
329 $ hg export .
330 # HG changeset patch
331 # User test
332 # Date 0 0
333 # Thu Jan 01 00:00:00 1970 +0000
334 # Node ID 4d6ed26797bc392c0099e48402a5134e669f1a60
335 # Parent 7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced
336 More addition
337
338 diff -r 7bc2f5967f5e -r 4d6ed26797bc a
339 --- a/a Thu Jan 01 00:00:00 1970 +0000
340 +++ b/a Thu Jan 01 00:00:00 1970 +0000
341 @@ -1,1 +1,9 @@
342 +jungle
343 a
344 +flore
345 +arthur
346 +zephir
347 +some
348 +less
349 +conflict
350 +babar
351
352 Check conflict during content-divergence resolution
353 ---------------------------------------------------
354
355 $ hg up --hidden 3932c176bbaa
356 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
357 updated to hidden changeset 3932c176bbaa
358 (hidden revision '3932c176bbaa' was rewritten as: 4d6ed26797bc)
359 working directory parent is obsolete! (3932c176bbaa)
360 (use 'hg evolve' to update to its successor: 4d6ed26797bc)
361 $ echo 'gotta break' >> a
362 $ hg amend
363 2 new content-divergent changesets
364
365 # reamend so that the case is not the first precursor.
366
367 $ hg amend -m "More addition (2)"
368 $ hg phase 'contentdivergent()'
369 15: draft
370 17: draft
371
372 $ glog
373 @ 17:0b336205a5d0@default(draft) bk:[] More addition (2)
374 |
375 | * 15:4d6ed26797bc@default(draft) bk:[] More addition
376 |/
377 | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
378 | |
379 o | 7:7bc2f5967f5e@default(draft) bk:[] add c
380 | |
381 | o 6:1cf0aacfd363@default(public) bk:[] newer a
382 |/
383 o 5:66719795a494@default(public) bk:[changea] changea
384 |
385 o 0:07f494440405@default(public) bk:[] adda
386
387
388 $ hg evolve -qn --content-divergent
389 hg update -c 0b336205a5d0 &&
390 hg merge 4d6ed26797bc &&
391 hg commit -m "auto merge resolving conflict between 0b336205a5d0 and 4d6ed26797bc"&&
392 hg up -C 3932c176bbaa &&
393 hg revert --all --rev tip &&
394 hg commit -m "`hg log -r 0b336205a5d0 --template={desc}`";
395 $ hg evolve --content-divergent
396 merge:[17] More addition (2)
397 with: [15] More addition
398 base: [12] More addition
399 merging "other" content-divergent changeset '4d6ed26797bc'
400 merging a
401 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
402 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
403 fix conflicts and see `hg help evolve.interrupted`
404 [1]
405
406 $ cat > a <<EOF
407 > jungle
408 > a
409 > flore
410 > arthur
411 > zephir
412 > some
413 > less
414 > conflict
415 > babar
416 > EOF
417
418 $ hg resolve -m
419 (no more unresolved files)
420 continue: hg evolve --continue
421 $ hg evolve --continue
422 working directory is now at e8746835a2a1
423 $ glog
424 @ 18:e8746835a2a1@default(draft) bk:[] More addition (2)
425 |
426 | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
427 | |
428 o | 7:7bc2f5967f5e@default(draft) bk:[] add c
429 | |
430 | o 6:1cf0aacfd363@default(public) bk:[] newer a
431 |/
432 o 5:66719795a494@default(public) bk:[changea] changea
433 |
434 o 0:07f494440405@default(public) bk:[] adda
435
436 $ hg exp
437 # HG changeset patch
438 # User test
439 # Date 0 0
440 # Thu Jan 01 00:00:00 1970 +0000
441 # Node ID e8746835a2a13122bc8c0ed84fe4ee35649af25d
442 # Parent 7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced
443 More addition (2)
444
445 diff -r 7bc2f5967f5e -r e8746835a2a1 a
446 --- a/a Thu Jan 01 00:00:00 1970 +0000
447 +++ b/a Thu Jan 01 00:00:00 1970 +0000
448 @@ -1,1 +1,9 @@
449 +jungle
450 a
451 +flore
452 +arthur
453 +zephir
454 +some
455 +less
456 +conflict
457 +babar