comparison tests/test-evolve-public-content-divergent-discard.t @ 4660:b62ed7c69561

branching: merge with stable
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 04 Jun 2019 11:08:44 +0200
parents tests/test-evolve-public-content-divergent.t@14437b18b024 tests/test-evolve-public-content-divergent.t@61c2518cd6d2
children 79bc0f1a832e b6c819facbe8
comparison
equal deleted inserted replaced
4659:4d2f8c99f23a 4660:b62ed7c69561
1 ===============================================================================
2 Tests the resolution of public content divergence: when merging leads to public
3 ===============================================================================
4
5 This file intend to cover all the cases possible when merging the other
6 divergent cset into public cset leads to public cset itself.
7 Possible variants are:
8
9 parent: same/different
10 relocation: [no-]conflict
11 merging: [no-]conflict
12
13 Setup
14 =====
15 $ cat >> $HGRCPATH <<EOF
16 > [alias]
17 > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {instabilities}\n\n"
18 > [phases]
19 > publish = False
20 > [extensions]
21 > rebase =
22 > EOF
23 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
24
25 Testing when same parent, no conflict:
26 --------------------------------------
27
28 $ hg init pubdiv1
29 $ cd pubdiv1
30 $ for ch in a b c; do
31 > echo $ch > $ch;
32 > hg ci -Am "added "$ch;
33 > done;
34 adding a
35 adding b
36 adding c
37
38 $ hg up .^
39 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
40 $ echo ch > ch
41 $ hg add ch
42 $ hg ci -m "added ch"
43 created new head
44
45 $ hg up .^
46 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
47 $ echo ch > ch
48 $ hg add ch
49 $ hg ci -m "added c"
50 created new head
51
52 $ hg glog
53 @ 4:f7c1071f1e7c added c
54 | draft
55 |
56 | o 3:90522bccf499 added ch
57 |/ draft
58 |
59 | o 2:155349b645be added c
60 |/ draft
61 |
62 o 1:5f6d8a4bf34a added b
63 | draft
64 |
65 o 0:9092f1db7931 added a
66 draft
67
68
69 $ hg prune 2 -s 3
70 1 changesets pruned
71 $ hg prune 2 -s 4 --hidden
72 1 changesets pruned
73 2 new content-divergent changesets
74 $ hg phase --public -r 4
75
76 $ hg glog
77 @ 4:f7c1071f1e7c added c
78 | public
79 |
80 | * 3:90522bccf499 added ch
81 |/ draft content-divergent
82 |
83 o 1:5f6d8a4bf34a added b
84 | public
85 |
86 o 0:9092f1db7931 added a
87 public
88
89 $ hg evolve --content-divergent --any
90 merge:[4] added c
91 with: [3] added ch
92 base: [2] added c
93 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 other divergent changeset 90522bccf499 has same content as local f7c1071f1e7c and differs by "description" only, discarding 90522bccf499
95 content divergence resolution between f7c1071f1e7c (public) and 90522bccf499 has same content as f7c1071f1e7c, discarding 90522bccf499
96
97 $ hg evolve -l
98
99 $ hg par
100 changeset: 4:f7c1071f1e7c
101 tag: tip
102 parent: 1:5f6d8a4bf34a
103 user: test
104 date: Thu Jan 01 00:00:00 1970 +0000
105 summary: added c
106
107 $ cd ..
108
109 Testing when different parent, no conflict:
110 -------------------------------------------
111
112 $ hg init pubdiv2
113 $ cd pubdiv2
114 $ for ch in a b c d; do
115 > echo $ch > $ch;
116 > hg ci -Am "added "$ch;
117 > done;
118 adding a
119 adding b
120 adding c
121 adding d
122
123 $ hg up 1
124 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
125 $ echo dh > dh
126 $ hg add dh
127 $ hg ci -m "added dh"
128 created new head
129
130 $ hg up 2
131 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
132 $ echo dh > dh
133 $ hg add dh
134 $ hg ci -m "added d"
135 created new head
136
137 $ hg glog
138 @ 5:e800202333a4 added d
139 | draft
140 |
141 | o 4:5acd58ef5066 added dh
142 | | draft
143 | |
144 +---o 3:9150fe93bec6 added d
145 | | draft
146 | |
147 o | 2:155349b645be added c
148 |/ draft
149 |
150 o 1:5f6d8a4bf34a added b
151 | draft
152 |
153 o 0:9092f1db7931 added a
154 draft
155
156
157 $ hg prune 3 -s 4
158 1 changesets pruned
159 $ hg prune 3 -s 5 --hidden
160 1 changesets pruned
161 2 new content-divergent changesets
162 $ hg phase --public -r 5
163
164 $ hg glog
165 @ 5:e800202333a4 added d
166 | public
167 |
168 | * 4:5acd58ef5066 added dh
169 | | draft content-divergent
170 | |
171 o | 2:155349b645be added c
172 |/ public
173 |
174 o 1:5f6d8a4bf34a added b
175 | public
176 |
177 o 0:9092f1db7931 added a
178 public
179
180 $ hg evolve --content-divergent --any
181 merge:[5] added d
182 with: [4] added dh
183 base: [3] added d
184 rebasing "other" content-divergent changeset 5acd58ef5066 on 155349b645be
185 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 other divergent changeset ae3429430ef1 has same content as local e800202333a4 and differs by "description" only, discarding ae3429430ef1
187 content divergence resolution between e800202333a4 (public) and ae3429430ef1 has same content as e800202333a4, discarding ae3429430ef1
188
189 $ hg evolve -l
190
191 $ hg par
192 changeset: 5:e800202333a4
193 tag: tip
194 parent: 2:155349b645be
195 user: test
196 date: Thu Jan 01 00:00:00 1970 +0000
197 summary: added d
198
199 $ cd ..
200
201 Testing when same parent, merging conflict:
202 -------------------------------------------
203
204 $ hg init pubdiv3
205 $ cd pubdiv3
206 $ for ch in a b c; do
207 > echo $ch > $ch;
208 > hg ci -Am "added "$ch;
209 > done;
210 adding a
211 adding b
212 adding c
213
214 $ hg up .^
215 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
216 $ echo chconflict > ch
217 $ hg add ch
218 $ hg ci -m "added ch"
219 created new head
220
221 $ hg up .^
222 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
223 $ echo ch > ch
224 $ hg add ch
225 $ hg ci -m "added c"
226 created new head
227
228 $ hg glog
229 @ 4:f7c1071f1e7c added c
230 | draft
231 |
232 | o 3:229da2719b19 added ch
233 |/ draft
234 |
235 | o 2:155349b645be added c
236 |/ draft
237 |
238 o 1:5f6d8a4bf34a added b
239 | draft
240 |
241 o 0:9092f1db7931 added a
242 draft
243
244
245 $ hg prune 2 -s 3
246 1 changesets pruned
247 $ hg prune 2 -s 4 --hidden
248 1 changesets pruned
249 2 new content-divergent changesets
250 $ hg phase --public -r 4
251
252 $ hg glog
253 @ 4:f7c1071f1e7c added c
254 | public
255 |
256 | * 3:229da2719b19 added ch
257 |/ draft content-divergent
258 |
259 o 1:5f6d8a4bf34a added b
260 | public
261 |
262 o 0:9092f1db7931 added a
263 public
264
265 $ hg evolve --content-divergent --any
266 merge:[4] added c
267 with: [3] added ch
268 base: [2] added c
269 merging ch
270 warning: conflicts while merging ch! (edit, then use 'hg resolve --mark')
271 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
272 fix conflicts and see `hg help evolve.interrupted`
273 [1]
274
275 $ hg diff
276 diff -r f7c1071f1e7c ch
277 --- a/ch Thu Jan 01 00:00:00 1970 +0000
278 +++ b/ch Thu Jan 01 00:00:00 1970 +0000
279 @@ -1,1 +1,5 @@
280 +<<<<<<< local: f7c1071f1e7c - test: added c
281 ch
282 +=======
283 +chconflict
284 +>>>>>>> other: 229da2719b19 - test: added ch
285
286 $ echo ch > ch
287 $ hg res -m
288 (no more unresolved files)
289 continue: hg evolve --continue
290
291 $ hg evolve --continue
292 other divergent changeset 229da2719b19 has same content as local f7c1071f1e7c and differs by "description" only, discarding 229da2719b19
293 working directory is now at f7c1071f1e7c
294
295 $ hg evolve -l
296
297 $ hg par
298 changeset: 4:f7c1071f1e7c
299 tag: tip
300 parent: 1:5f6d8a4bf34a
301 user: test
302 date: Thu Jan 01 00:00:00 1970 +0000
303 summary: added c
304
305 $ cd ..
306
307 Testing when different parent, relocation conflict:
308 ---------------------------------------------------
309
310 $ hg init pubdiv4
311 $ cd pubdiv4
312 $ for ch in a b c d; do
313 > echo $ch > $ch;
314 > hg ci -Am "added "$ch;
315 > done;
316 adding a
317 adding b
318 adding c
319 adding d
320
321 $ hg up 1
322 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
323 $ echo dh > dh
324 $ echo cc > c
325 $ hg add dh c
326 $ hg ci -m "added dh"
327 created new head
328
329 $ hg up 2
330 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
331 $ echo dh > dh
332 $ hg add dh
333 $ hg ci -m "added d"
334 created new head
335
336 $ hg glog
337 @ 5:e800202333a4 added d
338 | draft
339 |
340 | o 4:f89a8e2f86ac added dh
341 | | draft
342 | |
343 +---o 3:9150fe93bec6 added d
344 | | draft
345 | |
346 o | 2:155349b645be added c
347 |/ draft
348 |
349 o 1:5f6d8a4bf34a added b
350 | draft
351 |
352 o 0:9092f1db7931 added a
353 draft
354
355
356 $ hg prune 3 -s 4
357 1 changesets pruned
358 $ hg prune 3 -s 5 --hidden
359 1 changesets pruned
360 2 new content-divergent changesets
361 $ hg phase --public -r 5
362
363 $ hg glog
364 @ 5:e800202333a4 added d
365 | public
366 |
367 | * 4:f89a8e2f86ac added dh
368 | | draft content-divergent
369 | |
370 o | 2:155349b645be added c
371 |/ public
372 |
373 o 1:5f6d8a4bf34a added b
374 | public
375 |
376 o 0:9092f1db7931 added a
377 public
378
379 $ hg evolve --content-divergent --any
380 merge:[5] added d
381 with: [4] added dh
382 base: [3] added d
383 rebasing "other" content-divergent changeset f89a8e2f86ac on 155349b645be
384 merging c
385 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
386 fix conflicts and see `hg help evolve.interrupted`
387 [1]
388
389 $ echo c > c
390 $ hg res -m
391 (no more unresolved files)
392 continue: hg evolve --continue
393
394 $ hg evolve --continue
395 evolving 4:f89a8e2f86ac "added dh"
396 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
397 other divergent changeset bc309da55b88 has same content as local e800202333a4 and differs by "description" only, discarding bc309da55b88
398 working directory is now at e800202333a4
399
400 $ hg evolve -l
401
402 $ hg par
403 changeset: 5:e800202333a4
404 tag: tip
405 parent: 2:155349b645be
406 user: test
407 date: Thu Jan 01 00:00:00 1970 +0000
408 summary: added d
409
410 $ cd ..
411
412 Testing when different parent, merging conflict:
413 ------------------------------------------------
414
415 $ hg init pubdiv5
416 $ cd pubdiv5
417 $ for ch in a b c d; do
418 > echo $ch > $ch;
419 > hg ci -Am "added "$ch;
420 > done;
421 adding a
422 adding b
423 adding c
424 adding d
425
426 $ hg up 1
427 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
428 $ echo dhconflict > dh
429 $ hg add dh
430 $ hg ci -m "added dh"
431 created new head
432
433 $ hg up 2
434 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
435 $ echo dh > dh
436 $ hg add dh
437 $ hg ci -m "added d"
438 created new head
439
440 $ hg glog
441 @ 5:e800202333a4 added d
442 | draft
443 |
444 | o 4:db0b7bba0aae added dh
445 | | draft
446 | |
447 +---o 3:9150fe93bec6 added d
448 | | draft
449 | |
450 o | 2:155349b645be added c
451 |/ draft
452 |
453 o 1:5f6d8a4bf34a added b
454 | draft
455 |
456 o 0:9092f1db7931 added a
457 draft
458
459
460 $ hg prune 3 -s 4
461 1 changesets pruned
462 $ hg prune 3 -s 5 --hidden
463 1 changesets pruned
464 2 new content-divergent changesets
465 $ hg phase --public -r 5
466
467 $ hg glog
468 @ 5:e800202333a4 added d
469 | public
470 |
471 | * 4:db0b7bba0aae added dh
472 | | draft content-divergent
473 | |
474 o | 2:155349b645be added c
475 |/ public
476 |
477 o 1:5f6d8a4bf34a added b
478 | public
479 |
480 o 0:9092f1db7931 added a
481 public
482
483 $ hg evolve --content-divergent --any
484 merge:[5] added d
485 with: [4] added dh
486 base: [3] added d
487 rebasing "other" content-divergent changeset db0b7bba0aae on 155349b645be
488 merging dh
489 warning: conflicts while merging dh! (edit, then use 'hg resolve --mark')
490 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
491 fix conflicts and see `hg help evolve.interrupted`
492 [1]
493
494 $ echo dh > dh
495 $ hg res -m
496 (no more unresolved files)
497 continue: hg evolve --continue
498
499 $ hg evolve --continue
500 other divergent changeset a5bbf2042450 has same content as local e800202333a4 and differs by "description" only, discarding a5bbf2042450
501 working directory is now at e800202333a4
502
503 $ hg evolve -l
504
505 $ hg par
506 changeset: 5:e800202333a4
507 tag: tip
508 parent: 2:155349b645be
509 user: test
510 date: Thu Jan 01 00:00:00 1970 +0000
511 summary: added d
512
513 $ cd ..
514
515 Testing when different parent, conflict in relocation and merging:
516 ------------------------------------------------------------------
517
518 $ hg init pubdiv6
519 $ cd pubdiv6
520 $ for ch in a b c d; do
521 > echo $ch > $ch;
522 > hg ci -Am "added "$ch;
523 > done;
524 adding a
525 adding b
526 adding c
527 adding d
528
529 $ hg up 1
530 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
531 $ echo dhconflict > dh
532 $ echo cc > c
533 $ hg add dh c
534 $ hg ci -m "added dh"
535 created new head
536
537 $ hg up 2
538 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
539 $ echo dh > dh
540 $ hg add dh
541 $ hg ci -m "added d"
542 created new head
543
544 $ hg glog
545 @ 5:e800202333a4 added d
546 | draft
547 |
548 | o 4:67b19bbd770f added dh
549 | | draft
550 | |
551 +---o 3:9150fe93bec6 added d
552 | | draft
553 | |
554 o | 2:155349b645be added c
555 |/ draft
556 |
557 o 1:5f6d8a4bf34a added b
558 | draft
559 |
560 o 0:9092f1db7931 added a
561 draft
562
563
564 $ hg prune 3 -s 4
565 1 changesets pruned
566 $ hg prune 3 -s 5 --hidden
567 1 changesets pruned
568 2 new content-divergent changesets
569 $ hg phase --public -r 5
570
571 $ hg glog
572 @ 5:e800202333a4 added d
573 | public
574 |
575 | * 4:67b19bbd770f added dh
576 | | draft content-divergent
577 | |
578 o | 2:155349b645be added c
579 |/ public
580 |
581 o 1:5f6d8a4bf34a added b
582 | public
583 |
584 o 0:9092f1db7931 added a
585 public
586
587 $ hg evolve --content-divergent --any
588 merge:[5] added d
589 with: [4] added dh
590 base: [3] added d
591 rebasing "other" content-divergent changeset 67b19bbd770f on 155349b645be
592 merging c
593 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
594 fix conflicts and see `hg help evolve.interrupted`
595 [1]
596
597 $ echo c > c
598 $ hg res -m
599 (no more unresolved files)
600 continue: hg evolve --continue
601
602 $ hg evolve --continue
603 evolving 4:67b19bbd770f "added dh"
604 merging dh
605 warning: conflicts while merging dh! (edit, then use 'hg resolve --mark')
606 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
607 fix conflicts and see `hg help evolve.interrupted`
608 [1]
609
610 $ echo dh > dh
611 $ hg res -m
612 (no more unresolved files)
613 continue: hg evolve --continue
614
615 $ hg evolve --continue
616 other divergent changeset 09054d1f3c97 has same content as local e800202333a4 and differs by "description" only, discarding 09054d1f3c97
617 working directory is now at e800202333a4
618
619 $ hg evolve -l
620
621 $ hg par
622 changeset: 5:e800202333a4
623 tag: tip
624 parent: 2:155349b645be
625 user: test
626 date: Thu Jan 01 00:00:00 1970 +0000
627 summary: added d
628
629 $ cd ..
630
631 Testing that we warn the user for the metadata being lost in divergence resolution:
632 -----------------------------------------------------------------------------------
633
634 $ hg init pubdiv7
635 $ cd pubdiv7
636 $ for ch in a b c d; do
637 > echo $ch > $ch;
638 > hg ci -Am "added "$ch;
639 > done;
640 adding a
641 adding b
642 adding c
643 adding d
644
645 $ echo dada > d
646 $ hg amend
647 $ hg up -r "desc('added c')"
648 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
649 $ hg branch feature
650 marked working directory as branch feature
651 (branches are permanent and global, did you want a bookmark?)
652 $ echo dada > d
653 $ hg ci -Am "added d"
654 adding d
655 $ hg prune -r "min(desc('added d'))" -s . --hidden
656 1 changesets pruned
657 2 new content-divergent changesets
658
659 (publish one side)
660 $ hg phase --public
661 $ hg up -r "draft()"
662 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
663
664 (make other divergent a closed branch head)
665 $ hg ci --amend -m "closing feature branch" --close-branch
666
667 $ hg glog
668 @ 6:af442315d198 closing feature branch
669 | draft content-divergent
670 |
671 | o 5:497d0d2b90ba added d
672 |/ public
673 |
674 o 2:155349b645be added c
675 | public
676 |
677 o 1:5f6d8a4bf34a added b
678 | public
679 |
680 o 0:9092f1db7931 added a
681 public
682
683
684 Run automatic evolution:
685
686 $ hg evolve --content-divergent
687 merge:[5] added d
688 with: [6] closing feature branch
689 base: [3] added d
690 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
691 other divergent changeset af442315d198 is a closed branch head and differs from local 497d0d2b90ba by "branch, description" only, discarding af442315d198
692 content divergence resolution between 497d0d2b90ba (public) and af442315d198 has same content as 497d0d2b90ba, discarding af442315d198
693 working directory is now at 497d0d2b90ba
694