comparison tests/test-evolve-public-content-divergent-main.t @ 4530:d081cc4f5fef

tests: consolidate the public-content-divergent test cases This commit move the public-content-divergent tests in dedicated test files.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Wed, 17 Apr 2019 00:20:44 +0530
parents tests/test-evolve-public-content-divergent.t@14437b18b024
children 96ce1030d2fb
comparison
equal deleted inserted replaced
4529:e0eaa33a1f8a 4530:d081cc4f5fef
1 =============================================================
2 Tests the resolution of public content divergence: main cases
3 =============================================================
4
5 This file intend to cover all the common cases of public content divergence.
6 That is all the variant of:
7 parent: same/different
8 relocation: [no-]conflict
9 merging: [no-]conflict
10
11 Setup
12 =====
13 $ cat >> $HGRCPATH <<EOF
14 > [alias]
15 > glog = log -GT "{rev}:{node|short} {desc|firstline}\n {phase} {troubles}\n\n"
16 > [phases]
17 > publish = False
18 > [extensions]
19 > rebase =
20 > EOF
21 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
22
23 Testing when same parent, no conflict:
24 --------------------------------------
25
26 Prepare the repository:
27
28 $ hg init pubdiv1
29 $ cd pubdiv1
30 $ for ch in a b; do
31 > echo $ch > $ch;
32 > hg ci -Aqm "added "$ch;
33 > done;
34 $ hg glog
35 @ 1:5f6d8a4bf34a added b
36 | draft
37 |
38 o 0:9092f1db7931 added a
39 draft
40
41
42 Make an amend and change phase to public:
43
44 $ sed -i "1 i I am first" b
45 $ hg amend
46 $ hg phase --public
47
48 Amend again to create a cset divergent to public one:
49
50 $ hg up 1 --hidden -q
51 updated to hidden changeset 5f6d8a4bf34a
52 (hidden revision '5f6d8a4bf34a' was rewritten as: 44f360db368f)
53 working directory parent is obsolete! (5f6d8a4bf34a)
54
55 $ echo "I am second" >> b
56 $ hg ci --amend -m "updated b"
57 1 new content-divergent changesets
58
59 $ hg glog
60 @ 3:dcdaf152280a updated b
61 | draft content-divergent
62 |
63 | o 2:44f360db368f added b
64 |/ public
65 |
66 o 0:9092f1db7931 added a
67 public
68
69
70 Lets resolve the public content-divergence:
71
72 $ hg evolve --content-divergent
73 merge:[2] added b
74 with: [3] updated b
75 base: [1] added b
76 updating to "local" side of the conflict: 44f360db368f
77 merging "other" content-divergent changeset 'dcdaf152280a'
78 merging b
79 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
80 committed as c1aa9cfb6cf8
81 working directory is now at c1aa9cfb6cf8
82
83 Following graph log shows that it correctly merged the two divergent csets:
84
85 $ hg glog -p
86 @ 5:c1aa9cfb6cf8 phase-divergent update to 44f360db368f:
87 | draft
88 |
89 | diff -r 44f360db368f -r c1aa9cfb6cf8 b
90 | --- a/b Thu Jan 01 00:00:00 1970 +0000
91 | +++ b/b Thu Jan 01 00:00:00 1970 +0000
92 | @@ -1,2 +1,3 @@
93 | I am first
94 | b
95 | +I am second
96 |
97 o 2:44f360db368f added b
98 | public
99 |
100 | diff -r 9092f1db7931 -r 44f360db368f b
101 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000
102 | +++ b/b Thu Jan 01 00:00:00 1970 +0000
103 | @@ -0,0 +1,2 @@
104 | +I am first
105 | +b
106 |
107 o 0:9092f1db7931 added a
108 public
109
110 diff -r 000000000000 -r 9092f1db7931 a
111 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
112 +++ b/a Thu Jan 01 00:00:00 1970 +0000
113 @@ -0,0 +1,1 @@
114 +a
115
116 $ hg evolve -l
117 $ cd ..
118
119 Testing when same parent, merging conflict:
120 -------------------------------------------
121
122 Prepare the repository:
123
124 $ hg init pubdiv2
125 $ cd pubdiv2
126 $ for ch in a b; do
127 > echo $ch > $ch;
128 > hg ci -Aqm "added "$ch;
129 > done;
130 $ hg glog
131 @ 1:5f6d8a4bf34a added b
132 | draft
133 |
134 o 0:9092f1db7931 added a
135 draft
136
137
138 Make an amend and change phase to public:
139
140 $ echo "I am foo" > b
141 $ hg amend
142 $ hg phase --public
143
144 Amend again to create a cset divergent to public one:
145
146 $ hg up 1 --hidden -q
147 updated to hidden changeset 5f6d8a4bf34a
148 (hidden revision '5f6d8a4bf34a' was rewritten as: 580f2d01e52c)
149 working directory parent is obsolete! (5f6d8a4bf34a)
150
151 $ echo "I am bar" > b
152 $ hg ci --amend -m "updated b"
153 1 new content-divergent changesets
154
155 $ hg glog
156 @ 3:0e805383168e updated b
157 | draft content-divergent
158 |
159 | o 2:580f2d01e52c added b
160 |/ public
161 |
162 o 0:9092f1db7931 added a
163 public
164
165
166 Lets resolve the divergence:
167
168 $ hg evolve --content-divergent
169 merge:[2] added b
170 with: [3] updated b
171 base: [1] added b
172 updating to "local" side of the conflict: 580f2d01e52c
173 merging "other" content-divergent changeset '0e805383168e'
174 merging b
175 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
176 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
177 fix conflicts and see `hg help evolve.interrupted`
178 [1]
179
180 $ echo "I am foobar" > b
181 $ hg resolve -m --tool union
182 (no more unresolved files)
183 continue: hg evolve --continue
184 $ hg evolve --continue
185 committed as 1a739394e9d4
186 working directory is now at 1a739394e9d4
187
188 $ hg glog
189 @ 5:1a739394e9d4 phase-divergent update to 580f2d01e52c:
190 | draft
191 |
192 o 2:580f2d01e52c added b
193 | public
194 |
195 o 0:9092f1db7931 added a
196 public
197
198 Testing when different parent, no conflict:
199 -------------------------------------------
200
201 $ hg init pubdiv3
202 $ cd pubdiv3
203 $ for ch in a b c d; do
204 > echo $ch > $ch;
205 > hg ci -Aqm "added "$ch;
206 > done;
207
208 $ hg up .^
209 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
210 $ echo dd > d
211 $ hg add d
212 $ hg ci -m "added d"
213 created new head
214
215 $ hg up 1
216 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
217 $ echo dd > d
218 $ echo e > e
219 $ hg add d e
220 $ hg ci -m "added d e"
221 created new head
222
223 $ hg glog
224 @ 5:4291d72ee19a added d e
225 | draft
226 |
227 | o 4:93cd84bbdaca added d
228 | | draft
229 | |
230 | | o 3:9150fe93bec6 added d
231 | |/ draft
232 | |
233 | o 2:155349b645be added c
234 |/ draft
235 |
236 o 1:5f6d8a4bf34a added b
237 | draft
238 |
239 o 0:9092f1db7931 added a
240 draft
241
242
243 $ hg prune 3 -s 5
244 1 changesets pruned
245 $ hg prune 3 -s 4 --hidden
246 1 changesets pruned
247 2 new content-divergent changesets
248
249 Change phase to public for one head:
250 $ hg phase -r 4 --public
251
252 $ hg glog
253 @ 5:4291d72ee19a added d e
254 | draft content-divergent
255 |
256 | o 4:93cd84bbdaca added d
257 | | public
258 | |
259 | o 2:155349b645be added c
260 |/ public
261 |
262 o 1:5f6d8a4bf34a added b
263 | public
264 |
265 o 0:9092f1db7931 added a
266 public
267
268
269 $ hg evolve --content-divergent --any
270 merge:[4] added d
271 with: [5] added d e
272 base: [3] added d
273 rebasing "other" content-divergent changeset 4291d72ee19a on 155349b645be
274 updating to "local" side of the conflict: 93cd84bbdaca
275 merging "other" content-divergent changeset 'f88581407163'
276 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
277 committed as 4cbe48a0c3d9
278 working directory is now at 4cbe48a0c3d9
279
280 $ hg glog -l 1
281 @ 8:4cbe48a0c3d9 phase-divergent update to 93cd84bbdaca:
282 | draft
283 ~
284
285 $ hg evolve -l
286 $ cd ..
287
288 Testing when different parents, relocation conflict:
289 ----------------------------------------------------
290
291 $ hg init pubdiv4
292 $ cd pubdiv4
293 $ for ch in a b c d; do
294 > echo $ch > $ch;
295 > hg ci -Aqm "added "$ch;
296 > done;
297
298 $ hg up .^^
299 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
300 $ echo d > d
301 $ echo cfoo > c
302 $ echo e > e
303 $ hg add d c e
304 $ hg ci -m "added d c e"
305 created new head
306
307 $ hg up 'desc("added c")'
308 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
309 $ echo dd > d
310 $ hg add d
311 $ hg ci -m "added d"
312 created new head
313
314 $ hg glog
315 @ 5:93cd84bbdaca added d
316 | draft
317 |
318 | o 4:f31bcc378766 added d c e
319 | | draft
320 | |
321 +---o 3:9150fe93bec6 added d
322 | | draft
323 | |
324 o | 2:155349b645be added c
325 |/ draft
326 |
327 o 1:5f6d8a4bf34a added b
328 | draft
329 |
330 o 0:9092f1db7931 added a
331 draft
332
333 $ hg prune 'min(desc("re:added d$"))' -s 'max(desc("re:added d$"))'
334 1 changesets pruned
335 $ hg prune 'min(desc("re:added d$"))' -s 'desc("added d c e")' --hidden
336 1 changesets pruned
337 2 new content-divergent changesets
338
339 Change phase to public for one head:
340 $ hg phase --public -r 'max(desc("re:added d$"))'
341
342 $ hg glog
343 @ 5:93cd84bbdaca added d
344 | public
345 |
346 | * 4:f31bcc378766 added d c e
347 | | draft content-divergent
348 | |
349 o | 2:155349b645be added c
350 |/ public
351 |
352 o 1:5f6d8a4bf34a added b
353 | public
354 |
355 o 0:9092f1db7931 added a
356 public
357
358 $ hg evolve --content-divergent --any
359 merge:[5] added d
360 with: [4] added d c e
361 base: [3] added d
362 rebasing "other" content-divergent changeset f31bcc378766 on 155349b645be
363 merging c
364 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
365 fix conflicts and see `hg help evolve.interrupted`
366 [1]
367
368 $ hg diff
369 diff -r 155349b645be c
370 --- a/c Thu Jan 01 00:00:00 1970 +0000
371 +++ b/c Thu Jan 01 00:00:00 1970 +0000
372 @@ -1,1 +1,5 @@
373 +<<<<<<< destination: 155349b645be - test: added c
374 c
375 +=======
376 +cfoo
377 +>>>>>>> evolving: f31bcc378766 - test: added d c e
378 diff -r 155349b645be d
379 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
380 +++ b/d Thu Jan 01 00:00:00 1970 +0000
381 @@ -0,0 +1,1 @@
382 +d
383 diff -r 155349b645be e
384 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
385 +++ b/e Thu Jan 01 00:00:00 1970 +0000
386 @@ -0,0 +1,1 @@
387 +e
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:f31bcc378766 "added d c e"
396 updating to "local" side of the conflict: 93cd84bbdaca
397 merging "other" content-divergent changeset 'bd28d3e4a228'
398 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
399 committed as 412dde898967
400 working directory is now at 412dde898967
401 $ hg export
402 # HG changeset patch
403 # User test
404 # Date 0 0
405 # Thu Jan 01 00:00:00 1970 +0000
406 # Node ID 412dde898967b50e7d334aefff778a9af46d29d1
407 # Parent 93cd84bbdacaeb8f881c29a609dbdd30c38cbc57
408 phase-divergent update to 93cd84bbdaca:
409
410 added d c e
411
412 diff -r 93cd84bbdaca -r 412dde898967 e
413 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
414 +++ b/e Thu Jan 01 00:00:00 1970 +0000
415 @@ -0,0 +1,1 @@
416 +e
417
418 $ hg evolve -l
419 $ cd ..
420
421 Testing when merging conflicts, relocation don't:
422 -------------------------------------------------
423
424 $ hg init pubdiv5
425 $ cd pubdiv5
426 $ for ch in a b c d; do
427 > echo $ch > $ch;
428 > hg ci -Aqm "added "$ch;
429 > done;
430
431 $ hg up .^^
432 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
433 $ echo dconflict > d
434 $ hg add d
435 $ hg ci -m "added d"
436 created new head
437
438 $ hg up 2
439 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
440 $ echo dd > d
441 $ hg add d
442 $ hg ci -m "added d"
443 created new head
444
445 $ hg glog
446 @ 5:93cd84bbdaca added d
447 | draft
448 |
449 | o 4:9411ad1fe615 added d
450 | | draft
451 | |
452 +---o 3:9150fe93bec6 added d
453 | | draft
454 | |
455 o | 2:155349b645be added c
456 |/ draft
457 |
458 o 1:5f6d8a4bf34a added b
459 | draft
460 |
461 o 0:9092f1db7931 added a
462 draft
463
464 $ hg prune 3 -s 5
465 1 changesets pruned
466 $ hg prune 3 -s 4 --hidden
467 1 changesets pruned
468 2 new content-divergent changesets
469
470 Change phase to public for one head:
471 $ hg phase --public -r 5
472
473 $ hg glog
474 @ 5:93cd84bbdaca added d
475 | public
476 |
477 | * 4:9411ad1fe615 added d
478 | | draft content-divergent
479 | |
480 o | 2:155349b645be added c
481 |/ public
482 |
483 o 1:5f6d8a4bf34a added b
484 | public
485 |
486 o 0:9092f1db7931 added a
487 public
488
489 $ hg evolve --content-divergent --any
490 merge:[5] added d
491 with: [4] added d
492 base: [3] added d
493 rebasing "other" content-divergent changeset 9411ad1fe615 on 155349b645be
494 updating to "local" side of the conflict: 93cd84bbdaca
495 merging "other" content-divergent changeset 'b5c690cdf1d5'
496 merging d
497 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
498 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
499 fix conflicts and see `hg help evolve.interrupted`
500 [1]
501
502 $ echo d > d
503 $ hg res -m
504 (no more unresolved files)
505 continue: hg evolve --continue
506
507 $ hg evolve --continue
508 committed as 2a0f44767904
509 working directory is now at 2a0f44767904
510
511 $ hg evolve -l
512 $ cd ..
513
514 Testing when relocation, merging both conflict:
515 -----------------------------------------------
516
517 $ hg init pubdiv6
518 $ cd pubdiv6
519 $ for ch in a b c d; do
520 > echo $ch > $ch;
521 > hg ci -Aqm "added "$ch;
522 > done;
523
524 $ hg up .^^
525 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
526 $ echo cfoo > c
527 $ echo e > e
528 $ echo dconflict > d
529 $ hg add c e d
530 $ hg ci -m "added c e"
531 created new head
532
533 $ hg up 2
534 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
535 $ echo dd > d
536 $ hg add d
537 $ hg ci -m "added d"
538 created new head
539
540 $ hg glog
541 @ 5:93cd84bbdaca added d
542 | draft
543 |
544 | o 4:3c17c7afaf6e added c e
545 | | draft
546 | |
547 +---o 3:9150fe93bec6 added d
548 | | draft
549 | |
550 o | 2:155349b645be added c
551 |/ draft
552 |
553 o 1:5f6d8a4bf34a added b
554 | draft
555 |
556 o 0:9092f1db7931 added a
557 draft
558
559 $ hg prune 3 -s 5
560 1 changesets pruned
561 $ hg prune 3 -s 4 --hidden
562 1 changesets pruned
563 2 new content-divergent changesets
564
565 Change phase to public for one head:
566 $ hg phase --public -r 5
567
568 $ hg glog
569 @ 5:93cd84bbdaca added d
570 | public
571 |
572 | * 4:3c17c7afaf6e added c e
573 | | draft content-divergent
574 | |
575 o | 2:155349b645be added c
576 |/ public
577 |
578 o 1:5f6d8a4bf34a added b
579 | public
580 |
581 o 0:9092f1db7931 added a
582 public
583
584 $ hg evolve --content-divergent --any
585 merge:[5] added d
586 with: [4] added c e
587 base: [3] added d
588 rebasing "other" content-divergent changeset 3c17c7afaf6e on 155349b645be
589 merging c
590 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
591 fix conflicts and see `hg help evolve.interrupted`
592 [1]
593
594 $ hg diff
595 diff -r 155349b645be c
596 --- a/c Thu Jan 01 00:00:00 1970 +0000
597 +++ b/c Thu Jan 01 00:00:00 1970 +0000
598 @@ -1,1 +1,5 @@
599 +<<<<<<< destination: 155349b645be - test: added c
600 c
601 +=======
602 +cfoo
603 +>>>>>>> evolving: 3c17c7afaf6e - test: added c e
604 diff -r 155349b645be d
605 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
606 +++ b/d Thu Jan 01 00:00:00 1970 +0000
607 @@ -0,0 +1,1 @@
608 +dconflict
609 diff -r 155349b645be e
610 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
611 +++ b/e Thu Jan 01 00:00:00 1970 +0000
612 @@ -0,0 +1,1 @@
613 +e
614
615 $ echo cfoo > c
616 $ hg res -m
617 (no more unresolved files)
618 continue: hg evolve --continue
619
620 $ hg evolve --continue
621 evolving 4:3c17c7afaf6e "added c e"
622 updating to "local" side of the conflict: 93cd84bbdaca
623 merging "other" content-divergent changeset 'c4ce3d34e784'
624 merging d
625 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
626 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
627 fix conflicts and see `hg help evolve.interrupted`
628 [1]
629
630 $ echo d > d
631 $ hg res -m
632 (no more unresolved files)
633 continue: hg evolve --continue
634
635 $ hg evolve --continue
636 committed as b9082a9e66ce
637 working directory is now at b9082a9e66ce
638
639 $ hg evolve -l
640 $ cd ..