comparison tests/test-evolve-content-divergent-interrupted.t @ 4481:d02a7c8cdee5 stable

test: consolidate the content-divergent test cases This commit move most of the content divergent related test in dedicated and thematic test files.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 10 Apr 2019 14:32:00 +0200
parents tests/test-evolve-abort-contentdiv.t@d081528bb372
children d70db7e455dc 75e76141cba2
comparison
equal deleted inserted replaced
4480:d18044dfc584 4481:d02a7c8cdee5
1 =======================================================
2 Tests the resolution of content divergence: interrupted
3 =======================================================
4
5 This file intend to cover case where evolve has to be interrupted.
6
7 This test aims at gather test case for --abort, --continue and --stop
8
9
10 Tests for the --abort flag for `hg evolve` command while content-divergence resolution
11 ======================================================================================
12
13 The `--abort` flag aborts the interrupted evolve by undoing all the work which
14 was done during resolution i.e. stripping new changesets created, moving
15 bookmarks back, moving working directory back.
16
17 This test contains cases when `hg evolve` is doing content-divergence resolution.
18
19 Setup
20 =====
21
22 $ cat >> $HGRCPATH <<EOF
23 > [phases]
24 > publish = False
25 > [alias]
26 > glog = log -GT "{rev}:{node|short} {desc}\n ({bookmarks}) {phase}"
27 > [extensions]
28 > EOF
29 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
30
31 $ hg init abortrepo
32 $ cd abortrepo
33 $ echo ".*\.orig" > .hgignore
34 $ hg add .hgignore
35 $ hg ci -m "added hgignore"
36 $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
37
38 $ hg glog
39 @ 4:c41c793e0ef1 added d
40 | () draft
41 o 3:ca1b80f7960a added c
42 | () draft
43 o 2:b1661037fa25 added b
44 | () draft
45 o 1:c7586e2a9264 added a
46 | () draft
47 o 0:8fa14d15e168 added hgignore
48 () draft
49
50 Creating content divergence, resolution of which will lead to conflicts
51 -----------------------------------------------------------------------
52
53 $ echo bar > d
54 $ hg amend
55
56 $ hg up c41c793e0ef1 --hidden
57 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 updated to hidden changeset c41c793e0ef1
59 (hidden revision 'c41c793e0ef1' was rewritten as: e49523854bc8)
60 working directory parent is obsolete! (c41c793e0ef1)
61 (use 'hg evolve' to update to its successor: e49523854bc8)
62
63 $ echo foobar > d
64 $ hg amend
65 2 new content-divergent changesets
66 $ hg glog --hidden
67 @ 6:9c1631e352d9 added d
68 | () draft
69 | * 5:e49523854bc8 added d
70 |/ () draft
71 | x 4:c41c793e0ef1 added d
72 |/ () draft
73 o 3:ca1b80f7960a added c
74 | () draft
75 o 2:b1661037fa25 added b
76 | () draft
77 o 1:c7586e2a9264 added a
78 | () draft
79 o 0:8fa14d15e168 added hgignore
80 () draft
81
82 $ hg evolve --content-divergent
83 merge:[6] added d
84 with: [5] added d
85 base: [4] added d
86 merging "other" content-divergent changeset 'e49523854bc8'
87 merging d
88 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
89 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
90 fix conflicts and see `hg help evolve.interrupted`
91 [1]
92
93 $ hg status -v
94 M d
95 # The repository is in an unfinished *evolve* state.
96
97 # Unresolved merge conflicts:
98 #
99 # d
100 #
101 # To mark files as resolved: hg resolve --mark FILE
102
103 # To continue: hg evolve --continue
104 # To abort: hg evolve --abort
105 # To stop: hg evolve --stop
106 # (also see `hg help evolve.interrupted`)
107
108 $ hg parents
109 changeset: 6:9c1631e352d9
110 tag: tip
111 parent: 3:ca1b80f7960a
112 user: test
113 date: Thu Jan 01 00:00:00 1970 +0000
114 instability: content-divergent
115 summary: added d
116
117 changeset: 5:e49523854bc8
118 parent: 3:ca1b80f7960a
119 user: test
120 date: Thu Jan 01 00:00:00 1970 +0000
121 instability: content-divergent
122 summary: added d
123
124
125 $ hg evolve --abort
126 evolve aborted
127 working directory is now at 9c1631e352d9
128
129 $ hg glog --hidden
130 @ 6:9c1631e352d9 added d
131 | () draft
132 | * 5:e49523854bc8 added d
133 |/ () draft
134 | x 4:c41c793e0ef1 added d
135 |/ () draft
136 o 3:ca1b80f7960a added c
137 | () draft
138 o 2:b1661037fa25 added b
139 | () draft
140 o 1:c7586e2a9264 added a
141 | () draft
142 o 0:8fa14d15e168 added hgignore
143 () draft
144
145 Creating multiple content-divergence where resolution of last one results in
146 conflicts and resolution of first one resulted in no new commit
147 -----------------------------------------------------------------------------
148
149 $ echo watbar > d
150 $ hg amend
151 $ hg up .^
152 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
153 $ echo bar > c
154 $ hg amend
155 2 new orphan changesets
156 $ hg up ca1b80f7960a --hidden
157 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
158 working directory parent is obsolete! (ca1b80f7960a)
159 (use 'hg evolve' to update to its successor: 2ba73e31f264)
160 $ echo foobar > c
161 $ hg amend
162 2 new content-divergent changesets
163 $ echo bar > c
164 $ hg amend
165
166 $ hg glog --hidden
167 @ 10:491e10505bae added c
168 | () draft
169 | x 9:7398f702a162 added c
170 |/ () draft
171 | * 8:2ba73e31f264 added c
172 |/ () draft
173 | * 7:f0f1694f123e added d
174 | | () draft
175 | | x 6:9c1631e352d9 added d
176 | |/ () draft
177 | | * 5:e49523854bc8 added d
178 | |/ () draft
179 | | x 4:c41c793e0ef1 added d
180 | |/ () draft
181 | x 3:ca1b80f7960a added c
182 |/ () draft
183 o 2:b1661037fa25 added b
184 | () draft
185 o 1:c7586e2a9264 added a
186 | () draft
187 o 0:8fa14d15e168 added hgignore
188 () draft
189
190 $ hg evolve --all --content-divergent
191 merge:[8] added c
192 with: [10] added c
193 base: [3] added c
194 updating to "local" side of the conflict: 2ba73e31f264
195 merging "other" content-divergent changeset '491e10505bae'
196 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
197 merge:[5] added d
198 with: [7] added d
199 base: [4] added d
200 updating to "local" side of the conflict: e49523854bc8
201 merging "other" content-divergent changeset 'f0f1694f123e'
202 merging d
203 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
204 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
205 fix conflicts and see `hg help evolve.interrupted`
206 [1]
207
208 $ hg evolve --abort
209 2 new content-divergent changesets
210 evolve aborted
211 working directory is now at 491e10505bae
212
213 $ hg glog --hidden
214 @ 10:491e10505bae added c
215 | () draft
216 | x 9:7398f702a162 added c
217 |/ () draft
218 | * 8:2ba73e31f264 added c
219 |/ () draft
220 | * 7:f0f1694f123e added d
221 | | () draft
222 | | x 6:9c1631e352d9 added d
223 | |/ () draft
224 | | * 5:e49523854bc8 added d
225 | |/ () draft
226 | | x 4:c41c793e0ef1 added d
227 | |/ () draft
228 | x 3:ca1b80f7960a added c
229 |/ () draft
230 o 2:b1661037fa25 added b
231 | () draft
232 o 1:c7586e2a9264 added a
233 | () draft
234 o 0:8fa14d15e168 added hgignore
235 () draft
236
237 $ hg obslog -r . --all
238 * 2ba73e31f264 (8) added c
239 |
240 | @ 491e10505bae (10) added c
241 | |
242 | x 7398f702a162 (9) added c
243 |/ rewritten(content) as 491e10505bae using amend by test (Thu Jan 01 00:00:00 1970 +0000)
244 |
245 x ca1b80f7960a (3) added c
246 rewritten(content) as 2ba73e31f264 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
247 rewritten(content) as 7398f702a162 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
248
249 $ cd ..
250
251 Creating content-divergence on multiple parents when gca of divergent changesets
252 is parent of one of the divergents and relocating leads to conflicts
253 ---------------------------------------------------------------------------------
254
255 $ hg init multiparent
256 $ cd multiparent
257 $ echo ".*\.orig" > .hgignore
258 $ hg add .hgignore
259 $ hg ci -m "added hgignore"
260 $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
261
262 $ hg glog
263 @ 4:c41c793e0ef1 added d
264 | () draft
265 o 3:ca1b80f7960a added c
266 | () draft
267 o 2:b1661037fa25 added b
268 | () draft
269 o 1:c7586e2a9264 added a
270 | () draft
271 o 0:8fa14d15e168 added hgignore
272 () draft
273
274 $ hg rebase -r . -d .^^^ --config extensions.rebase=
275 rebasing 4:c41c793e0ef1 "added d" (tip)
276 $ echo bar > c
277 $ hg add c
278 $ hg amend
279
280 $ hg up --hidden c41c793e0ef1
281 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
282 updated to hidden changeset c41c793e0ef1
283 (hidden revision 'c41c793e0ef1' was rewritten as: 69bdd23a9b0d)
284 working directory parent is obsolete! (c41c793e0ef1)
285 (use 'hg evolve' to update to its successor: 69bdd23a9b0d)
286 $ echo bar > d
287 $ hg amend
288 2 new content-divergent changesets
289
290 $ hg glog
291 @ 7:e49523854bc8 added d
292 | () draft
293 | * 6:69bdd23a9b0d added d
294 | | () draft
295 o | 3:ca1b80f7960a added c
296 | | () draft
297 o | 2:b1661037fa25 added b
298 |/ () draft
299 o 1:c7586e2a9264 added a
300 | () draft
301 o 0:8fa14d15e168 added hgignore
302 () draft
303
304 $ hg evolve --content-divergent
305 merge:[7] added d
306 with: [6] added d
307 base: [4] added d
308 rebasing "other" content-divergent changeset 69bdd23a9b0d on ca1b80f7960a
309 merging c
310 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
311 fix conflicts and see `hg help evolve.interrupted`
312 [1]
313
314 $ hg evolve --abort
315 evolve aborted
316 working directory is now at e49523854bc8
317
318 $ hg glog
319 @ 7:e49523854bc8 added d
320 | () draft
321 | * 6:69bdd23a9b0d added d
322 | | () draft
323 o | 3:ca1b80f7960a added c
324 | | () draft
325 o | 2:b1661037fa25 added b
326 |/ () draft
327 o 1:c7586e2a9264 added a
328 | () draft
329 o 0:8fa14d15e168 added hgignore
330 () draft
331
332 Creating content-divergence on multiple parents when gca of divergent changesets
333 is parent of one of the divergents and merging divergent leads to conflicts
334 ---------------------------------------------------------------------------------
335
336 $ hg up 69bdd23a9b0d
337 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
338 $ hg rm c
339 $ echo wat > d
340 $ hg amend
341
342 $ hg glog
343 @ 8:33e4442acf98 added d
344 | () draft
345 | * 7:e49523854bc8 added d
346 | | () draft
347 | o 3:ca1b80f7960a added c
348 | | () draft
349 | o 2:b1661037fa25 added b
350 |/ () draft
351 o 1:c7586e2a9264 added a
352 | () draft
353 o 0:8fa14d15e168 added hgignore
354 () draft
355
356 $ hg evolve --content-divergent
357 merge:[7] added d
358 with: [8] added d
359 base: [4] added d
360 rebasing "other" content-divergent changeset 33e4442acf98 on ca1b80f7960a
361 updating to "local" side of the conflict: e49523854bc8
362 merging "other" content-divergent changeset 'a663d1567f0b'
363 merging d
364 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
365 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
366 fix conflicts and see `hg help evolve.interrupted`
367 [1]
368
369 $ hg evolve --abort
370 evolve aborted
371 working directory is now at 33e4442acf98
372
373 $ hg glog
374 @ 8:33e4442acf98 added d
375 | () draft
376 | * 7:e49523854bc8 added d
377 | | () draft
378 | o 3:ca1b80f7960a added c
379 | | () draft
380 | o 2:b1661037fa25 added b
381 |/ () draft
382 o 1:c7586e2a9264 added a
383 | () draft
384 o 0:8fa14d15e168 added hgignore
385 () draft
386 $ cd ..
387
388 Tests for the --stop flag for `hg evolve` command while resolving content-divergence
389 ==================================================================================
390
391 The `--stop` flag stops the interrupted evolution and delete the state file so
392 user can do other things and comeback and do evolution later on
393
394 This is testing cases when `hg evolve` command is doing content-divergence resolution.
395
396 Setup
397 =====
398
399 $ hg init stoprepo
400 $ cd stoprepo
401 $ echo ".*\.orig" > .hgignore
402 $ hg add .hgignore
403 $ hg ci -m "added hgignore"
404 $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done;
405
406 $ hg glog
407 @ 4:c41c793e0ef1 added d
408 | () draft
409 o 3:ca1b80f7960a added c
410 | () draft
411 o 2:b1661037fa25 added b
412 | () draft
413 o 1:c7586e2a9264 added a
414 | () draft
415 o 0:8fa14d15e168 added hgignore
416 () draft
417
418 Creating content divergence, resolution of which will lead to conflicts
419 -----------------------------------------------------------------------
420
421 $ echo bar > d
422 $ hg amend
423
424 $ hg up c41c793e0ef1 --hidden
425 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
426 updated to hidden changeset c41c793e0ef1
427 (hidden revision 'c41c793e0ef1' was rewritten as: e49523854bc8)
428 working directory parent is obsolete! (c41c793e0ef1)
429 (use 'hg evolve' to update to its successor: e49523854bc8)
430
431 $ echo foobar > d
432 $ hg amend
433 2 new content-divergent changesets
434 $ hg glog --hidden
435 @ 6:9c1631e352d9 added d
436 | () draft
437 | * 5:e49523854bc8 added d
438 |/ () draft
439 | x 4:c41c793e0ef1 added d
440 |/ () draft
441 o 3:ca1b80f7960a added c
442 | () draft
443 o 2:b1661037fa25 added b
444 | () draft
445 o 1:c7586e2a9264 added a
446 | () draft
447 o 0:8fa14d15e168 added hgignore
448 () draft
449
450 $ hg evolve --content-divergent
451 merge:[6] added d
452 with: [5] added d
453 base: [4] added d
454 merging "other" content-divergent changeset 'e49523854bc8'
455 merging d
456 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
457 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
458 fix conflicts and see `hg help evolve.interrupted`
459 [1]
460
461 $ hg evolve --stop
462 stopped the interrupted evolve
463 working directory is now at 9c1631e352d9
464
465 $ hg glog --hidden
466 @ 6:9c1631e352d9 added d
467 | () draft
468 | * 5:e49523854bc8 added d
469 |/ () draft
470 | x 4:c41c793e0ef1 added d
471 |/ () draft
472 o 3:ca1b80f7960a added c
473 | () draft
474 o 2:b1661037fa25 added b
475 | () draft
476 o 1:c7586e2a9264 added a
477 | () draft
478 o 0:8fa14d15e168 added hgignore
479 () draft
480
481 Content divergence with parent change which will result in conflicts while
482 merging
483 ---------------------------------------------------------------------------
484
485 $ hg rebase -r . -d .^^^ --config extensions.rebase=
486 rebasing 6:9c1631e352d9 "added d" (tip)
487
488 $ hg glog
489 @ 7:517d4375cb72 added d
490 | () draft
491 | * 5:e49523854bc8 added d
492 | | () draft
493 | o 3:ca1b80f7960a added c
494 | | () draft
495 | o 2:b1661037fa25 added b
496 |/ () draft
497 o 1:c7586e2a9264 added a
498 | () draft
499 o 0:8fa14d15e168 added hgignore
500 () draft
501
502 $ hg evolve --content-divergent
503 merge:[5] added d
504 with: [7] added d
505 base: [4] added d
506 rebasing "other" content-divergent changeset 517d4375cb72 on ca1b80f7960a
507 updating to "local" side of the conflict: e49523854bc8
508 merging "other" content-divergent changeset '606ad96040fc'
509 merging d
510 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
511 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
512 fix conflicts and see `hg help evolve.interrupted`
513 [1]
514
515 $ hg evolve --stop
516 stopped the interrupted evolve
517 working directory is now at 517d4375cb72
518
519 $ hg glog
520 @ 7:517d4375cb72 added d
521 | () draft
522 | * 5:e49523854bc8 added d
523 | | () draft
524 | o 3:ca1b80f7960a added c
525 | | () draft
526 | o 2:b1661037fa25 added b
527 |/ () draft
528 o 1:c7586e2a9264 added a
529 | () draft
530 o 0:8fa14d15e168 added hgignore
531 () draft
532
533 Content-divergence with parent-change which will result in conflicts while
534 relocation
535 ---------------------------------------------------------------------------
536
537 $ echo babar > c
538 $ hg add c
539 $ hg amend
540 $ hg glog
541 @ 8:8fd1c4bd144c added d
542 | () draft
543 | * 5:e49523854bc8 added d
544 | | () draft
545 | o 3:ca1b80f7960a added c
546 | | () draft
547 | o 2:b1661037fa25 added b
548 |/ () draft
549 o 1:c7586e2a9264 added a
550 | () draft
551 o 0:8fa14d15e168 added hgignore
552 () draft
553
554 $ hg evolve --content-divergent
555 merge:[5] added d
556 with: [8] added d
557 base: [4] added d
558 rebasing "other" content-divergent changeset 8fd1c4bd144c on ca1b80f7960a
559 merging c
560 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
561 fix conflicts and see `hg help evolve.interrupted`
562 [1]
563
564 $ hg diff
565 diff -r ca1b80f7960a c
566 --- a/c Thu Jan 01 00:00:00 1970 +0000
567 +++ b/c Thu Jan 01 00:00:00 1970 +0000
568 @@ -1,1 +1,5 @@
569 +<<<<<<< destination: ca1b80f7960a - test: added c
570 foo
571 +=======
572 +babar
573 +>>>>>>> evolving: 8fd1c4bd144c - test: added d
574 diff -r ca1b80f7960a d
575 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
576 +++ b/d Thu Jan 01 00:00:00 1970 +0000
577 @@ -0,0 +1,1 @@
578 +foobar
579
580 $ hg evolve --stop
581 stopped the interrupted evolve
582 working directory is now at ca1b80f7960a
583
584 XXX: we should have preserved the wdir to be at rev 8
585 $ hg glog
586 * 8:8fd1c4bd144c added d
587 | () draft
588 | * 5:e49523854bc8 added d
589 | | () draft
590 | @ 3:ca1b80f7960a added c
591 | | () draft
592 | o 2:b1661037fa25 added b
593 |/ () draft
594 o 1:c7586e2a9264 added a
595 | () draft
596 o 0:8fa14d15e168 added hgignore
597 () draft
598 $ cd ..