Mercurial > hg
comparison tests/test-rebase-obsolete3.t @ 46829:13b200ffe8eb
tests: split up test-rebase-obsolete.t in four pieces
The test case took 42 seconds to run the test before this patch and 12
seconds after (wall time, of course).
Differential Revision: https://phab.mercurial-scm.org/D10255
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 23 Mar 2021 09:13:29 -0700 |
parents | tests/test-rebase-obsolete.t@32399d0813e0 |
children | 6648307d4fe8 |
comparison
equal
deleted
inserted
replaced
46828:395cf404e76a | 46829:13b200ffe8eb |
---|---|
1 ========================== | |
2 Test rebase with obsolete | |
3 ========================== | |
4 | |
5 Enable obsolete | |
6 | |
7 $ cat >> $HGRCPATH << EOF | |
8 > [command-templates] | |
9 > log= {rev}:{node|short} {desc|firstline}{if(obsolete,' ({obsfate})')} | |
10 > [experimental] | |
11 > evolution.createmarkers=True | |
12 > evolution.allowunstable=True | |
13 > [phases] | |
14 > publish=False | |
15 > [extensions] | |
16 > rebase= | |
17 > drawdag=$TESTDIR/drawdag.py | |
18 > strip= | |
19 > EOF | |
20 | |
21 Divergence cases due to obsolete changesets | |
22 ------------------------------------------- | |
23 | |
24 We should ignore branches with unstable changesets when they are based on an | |
25 obsolete changeset which successor is in rebase set. | |
26 | |
27 $ hg init divergence | |
28 $ cd divergence | |
29 $ cat >> .hg/hgrc << EOF | |
30 > [extensions] | |
31 > strip = | |
32 > [alias] | |
33 > strip = strip --no-backup --quiet | |
34 > [templates] | |
35 > instabilities = '{rev}:{node|short} {desc|firstline}{if(instabilities," ({instabilities})")}\n' | |
36 > EOF | |
37 | |
38 $ hg debugdrawdag <<EOF | |
39 > e f | |
40 > | | | |
41 > d' d # replace: d -> d' | |
42 > \ / | |
43 > c | |
44 > | | |
45 > x b | |
46 > \| | |
47 > a | |
48 > EOF | |
49 1 new orphan changesets | |
50 $ hg log -G -r 'a':: | |
51 * 7:1143e9adc121 f | |
52 | | |
53 | o 6:d60ebfa0f1cb e | |
54 | | | |
55 | o 5:027ad6c5830d d' | |
56 | | | |
57 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d) | |
58 |/ | |
59 o 3:a82ac2b38757 c | |
60 | | |
61 | o 2:630d7c95eff7 x | |
62 | | | |
63 o | 1:488e1b7e7341 b | |
64 |/ | |
65 o 0:b173517d0057 a | |
66 | |
67 | |
68 Changeset d and its descendants are excluded to avoid divergence of d, which | |
69 would occur because the successor of d (d') is also in rebaseset. As a | |
70 consequence f (descendant of d) is left behind. | |
71 | |
72 $ hg rebase -b 'e' -d 'x' | |
73 rebasing 1:488e1b7e7341 b "b" | |
74 rebasing 3:a82ac2b38757 c "c" | |
75 rebasing 5:027ad6c5830d d' "d'" | |
76 rebasing 6:d60ebfa0f1cb e "e" | |
77 note: not rebasing 4:76be324c128b d "d" and its descendants as this would cause divergence | |
78 $ hg log -G -r 'a':: | |
79 o 11:eb6d63fc4ed5 e | |
80 | | |
81 o 10:44d8c724a70c d' | |
82 | | |
83 o 9:d008e6b4d3fd c | |
84 | | |
85 o 8:67e8f4a16c49 b | |
86 | | |
87 | * 7:1143e9adc121 f | |
88 | | | |
89 | | x 6:d60ebfa0f1cb e (rewritten using rebase as 11:eb6d63fc4ed5) | |
90 | | | | |
91 | | x 5:027ad6c5830d d' (rewritten using rebase as 10:44d8c724a70c) | |
92 | | | | |
93 | x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d) | |
94 | |/ | |
95 | x 3:a82ac2b38757 c (rewritten using rebase as 9:d008e6b4d3fd) | |
96 | | | |
97 o | 2:630d7c95eff7 x | |
98 | | | |
99 | x 1:488e1b7e7341 b (rewritten using rebase as 8:67e8f4a16c49) | |
100 |/ | |
101 o 0:b173517d0057 a | |
102 | |
103 $ hg strip -r 8: | |
104 $ hg log -G -r 'a':: | |
105 * 7:1143e9adc121 f | |
106 | | |
107 | o 6:d60ebfa0f1cb e | |
108 | | | |
109 | o 5:027ad6c5830d d' | |
110 | | | |
111 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d) | |
112 |/ | |
113 o 3:a82ac2b38757 c | |
114 | | |
115 | o 2:630d7c95eff7 x | |
116 | | | |
117 o | 1:488e1b7e7341 b | |
118 |/ | |
119 o 0:b173517d0057 a | |
120 | |
121 | |
122 If the rebase set has an obsolete (d) with a successor (d') outside the rebase | |
123 set and none in destination, we still get the divergence warning. | |
124 By allowing divergence, we can perform the rebase. | |
125 | |
126 $ hg rebase -r 'c'::'f' -d 'x' | |
127 abort: this rebase will cause divergences from: 76be324c128b | |
128 (to force the rebase please set experimental.evolution.allowdivergence=True) | |
129 [20] | |
130 $ hg rebase --config experimental.evolution.allowdivergence=true -r 'c'::'f' -d 'x' | |
131 rebasing 3:a82ac2b38757 c "c" | |
132 rebasing 4:76be324c128b d "d" | |
133 rebasing 7:1143e9adc121 f tip "f" | |
134 1 new orphan changesets | |
135 2 new content-divergent changesets | |
136 $ hg log -G -r 'a':: -T instabilities | |
137 o 10:e1744ea07510 f | |
138 | | |
139 * 9:e2b36ea9a0a0 d (content-divergent) | |
140 | | |
141 o 8:6a0376de376e c | |
142 | | |
143 | x 7:1143e9adc121 f | |
144 | | | |
145 | | * 6:d60ebfa0f1cb e (orphan) | |
146 | | | | |
147 | | * 5:027ad6c5830d d' (orphan content-divergent) | |
148 | | | | |
149 | x | 4:76be324c128b d | |
150 | |/ | |
151 | x 3:a82ac2b38757 c | |
152 | | | |
153 o | 2:630d7c95eff7 x | |
154 | | | |
155 | o 1:488e1b7e7341 b | |
156 |/ | |
157 o 0:b173517d0057 a | |
158 | |
159 $ hg strip -r 8: | |
160 | |
161 (Not skipping obsoletes means that divergence is allowed.) | |
162 | |
163 $ hg rebase --config experimental.rebaseskipobsolete=false -r 'c'::'f' -d 'x' | |
164 rebasing 3:a82ac2b38757 c "c" | |
165 rebasing 4:76be324c128b d "d" | |
166 rebasing 7:1143e9adc121 f tip "f" | |
167 1 new orphan changesets | |
168 2 new content-divergent changesets | |
169 | |
170 $ hg strip -r 0: | |
171 | |
172 Similar test on a more complex graph | |
173 | |
174 $ hg debugdrawdag <<EOF | |
175 > g | |
176 > | | |
177 > f e | |
178 > | | | |
179 > e' d # replace: e -> e' | |
180 > \ / | |
181 > c | |
182 > | | |
183 > x b | |
184 > \| | |
185 > a | |
186 > EOF | |
187 1 new orphan changesets | |
188 $ hg log -G -r 'a': | |
189 * 8:2876ce66c6eb g | |
190 | | |
191 | o 7:3ffec603ab53 f | |
192 | | | |
193 x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea) | |
194 | | | |
195 | o 5:63324dc512ea e' | |
196 | | | |
197 o | 4:76be324c128b d | |
198 |/ | |
199 o 3:a82ac2b38757 c | |
200 | | |
201 | o 2:630d7c95eff7 x | |
202 | | | |
203 o | 1:488e1b7e7341 b | |
204 |/ | |
205 o 0:b173517d0057 a | |
206 | |
207 $ hg rebase -b 'f' -d 'x' | |
208 rebasing 1:488e1b7e7341 b "b" | |
209 rebasing 3:a82ac2b38757 c "c" | |
210 rebasing 5:63324dc512ea e' "e'" | |
211 rebasing 7:3ffec603ab53 f "f" | |
212 rebasing 4:76be324c128b d "d" | |
213 note: not rebasing 6:e36fae928aec e "e" and its descendants as this would cause divergence | |
214 $ hg log -G -r 'a': | |
215 o 13:a1707a5b7c2c d | |
216 | | |
217 | o 12:ef6251596616 f | |
218 | | | |
219 | o 11:b6f172e64af9 e' | |
220 |/ | |
221 o 10:d008e6b4d3fd c | |
222 | | |
223 o 9:67e8f4a16c49 b | |
224 | | |
225 | * 8:2876ce66c6eb g | |
226 | | | |
227 | | x 7:3ffec603ab53 f (rewritten using rebase as 12:ef6251596616) | |
228 | | | | |
229 | x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea) | |
230 | | | | |
231 | | x 5:63324dc512ea e' (rewritten using rebase as 11:b6f172e64af9) | |
232 | | | | |
233 | x | 4:76be324c128b d (rewritten using rebase as 13:a1707a5b7c2c) | |
234 | |/ | |
235 | x 3:a82ac2b38757 c (rewritten using rebase as 10:d008e6b4d3fd) | |
236 | | | |
237 o | 2:630d7c95eff7 x | |
238 | | | |
239 | x 1:488e1b7e7341 b (rewritten using rebase as 9:67e8f4a16c49) | |
240 |/ | |
241 o 0:b173517d0057 a | |
242 | |
243 | |
244 issue5782 | |
245 $ hg strip -r 0: | |
246 $ hg debugdrawdag <<EOF | |
247 > d | |
248 > | | |
249 > c1 c # replace: c -> c1 | |
250 > \ / | |
251 > b | |
252 > | | |
253 > a | |
254 > EOF | |
255 1 new orphan changesets | |
256 $ hg debugobsolete `hg log -T "{node}" --hidden -r 'desc("c1")'` | |
257 1 new obsolescence markers | |
258 obsoleted 1 changesets | |
259 $ hg log -G -r 'a': --hidden | |
260 * 4:76be324c128b d | |
261 | | |
262 | x 3:ef8a456de8fa c1 (pruned) | |
263 | | | |
264 x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa) | |
265 |/ | |
266 o 1:488e1b7e7341 b | |
267 | | |
268 o 0:b173517d0057 a | |
269 | |
270 $ hg rebase -d 0 -r 2 | |
271 note: not rebasing 2:a82ac2b38757 c "c", it has no successor | |
272 $ hg log -G -r 'a': --hidden | |
273 * 4:76be324c128b d | |
274 | | |
275 | x 3:ef8a456de8fa c1 (pruned) | |
276 | | | |
277 x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa) | |
278 |/ | |
279 o 1:488e1b7e7341 b | |
280 | | |
281 o 0:b173517d0057 a | |
282 | |
283 $ cd .. | |
284 | |
285 Rebase merge where successor of one parent is equal to destination (issue5198) | |
286 | |
287 $ hg init p1-succ-is-dest | |
288 $ cd p1-succ-is-dest | |
289 | |
290 $ hg debugdrawdag <<EOF | |
291 > F | |
292 > /| | |
293 > E D B # replace: D -> B | |
294 > \|/ | |
295 > A | |
296 > EOF | |
297 1 new orphan changesets | |
298 | |
299 $ hg rebase -d B -s D | |
300 note: not rebasing 2:b18e25de2cf5 D "D", already in destination as 1:112478962961 B "B" | |
301 rebasing 4:66f1a38021c9 F tip "F" | |
302 $ hg log -G | |
303 o 5:50e9d60b99c6 F | |
304 |\ | |
305 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:50e9d60b99c6) | |
306 | |/| | |
307 | o | 3:7fb047a69f22 E | |
308 | | | | |
309 | | x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961) | |
310 | |/ | |
311 o | 1:112478962961 B | |
312 |/ | |
313 o 0:426bada5c675 A | |
314 | |
315 $ cd .. | |
316 | |
317 Rebase merge where successor of other parent is equal to destination | |
318 | |
319 $ hg init p2-succ-is-dest | |
320 $ cd p2-succ-is-dest | |
321 | |
322 $ hg debugdrawdag <<EOF | |
323 > F | |
324 > /| | |
325 > E D B # replace: E -> B | |
326 > \|/ | |
327 > A | |
328 > EOF | |
329 1 new orphan changesets | |
330 | |
331 $ hg rebase -d B -s E | |
332 note: not rebasing 3:7fb047a69f22 E "E", already in destination as 1:112478962961 B "B" | |
333 rebasing 4:66f1a38021c9 F tip "F" | |
334 $ hg log -G | |
335 o 5:aae1787dacee F | |
336 |\ | |
337 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:aae1787dacee) | |
338 | |/| | |
339 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961) | |
340 | | | | |
341 | o | 2:b18e25de2cf5 D | |
342 | |/ | |
343 o / 1:112478962961 B | |
344 |/ | |
345 o 0:426bada5c675 A | |
346 | |
347 $ cd .. | |
348 | |
349 Rebase merge where successor of one parent is ancestor of destination | |
350 | |
351 $ hg init p1-succ-in-dest | |
352 $ cd p1-succ-in-dest | |
353 | |
354 $ hg debugdrawdag <<EOF | |
355 > F C | |
356 > /| | | |
357 > E D B # replace: D -> B | |
358 > \|/ | |
359 > A | |
360 > EOF | |
361 1 new orphan changesets | |
362 | |
363 $ hg rebase -d C -s D | |
364 note: not rebasing 2:b18e25de2cf5 D "D", already in destination as 1:112478962961 B "B" | |
365 rebasing 5:66f1a38021c9 F tip "F" | |
366 | |
367 $ hg log -G | |
368 o 6:0913febf6439 F | |
369 |\ | |
370 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:0913febf6439) | |
371 | | | | |
372 | o | 4:26805aba1e60 C | |
373 | | | | |
374 o | | 3:7fb047a69f22 E | |
375 | | | | |
376 +---x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961) | |
377 | | | |
378 | o 1:112478962961 B | |
379 |/ | |
380 o 0:426bada5c675 A | |
381 | |
382 $ cd .. | |
383 | |
384 Rebase merge where successor of other parent is ancestor of destination | |
385 | |
386 $ hg init p2-succ-in-dest | |
387 $ cd p2-succ-in-dest | |
388 | |
389 $ hg debugdrawdag <<EOF | |
390 > F C | |
391 > /| | | |
392 > E D B # replace: E -> B | |
393 > \|/ | |
394 > A | |
395 > EOF | |
396 1 new orphan changesets | |
397 | |
398 $ hg rebase -d C -s E | |
399 note: not rebasing 3:7fb047a69f22 E "E", already in destination as 1:112478962961 B "B" | |
400 rebasing 5:66f1a38021c9 F tip "F" | |
401 $ hg log -G | |
402 o 6:c6ab0cc6d220 F | |
403 |\ | |
404 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:c6ab0cc6d220) | |
405 | | | | |
406 | o | 4:26805aba1e60 C | |
407 | | | | |
408 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961) | |
409 | | | | |
410 o---+ 2:b18e25de2cf5 D | |
411 / / | |
412 o / 1:112478962961 B | |
413 |/ | |
414 o 0:426bada5c675 A | |
415 | |
416 $ cd .. | |
417 | |
418 Rebase merge where successor of one parent is ancestor of destination | |
419 | |
420 $ hg init p1-succ-in-dest-b | |
421 $ cd p1-succ-in-dest-b | |
422 | |
423 $ hg debugdrawdag <<EOF | |
424 > F C | |
425 > /| | | |
426 > E D B # replace: E -> B | |
427 > \|/ | |
428 > A | |
429 > EOF | |
430 1 new orphan changesets | |
431 | |
432 $ hg rebase -d C -b F | |
433 rebasing 2:b18e25de2cf5 D "D" | |
434 note: not rebasing 3:7fb047a69f22 E "E", already in destination as 1:112478962961 B "B" | |
435 rebasing 5:66f1a38021c9 F tip "F" | |
436 note: not rebasing 5:66f1a38021c9 F tip "F", its destination already has all its changes | |
437 $ hg log -G | |
438 o 6:8f47515dda15 D | |
439 | | |
440 | x 5:66f1a38021c9 F (pruned using rebase) | |
441 | |\ | |
442 o | | 4:26805aba1e60 C | |
443 | | | | |
444 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961) | |
445 | | | | |
446 | x | 2:b18e25de2cf5 D (rewritten using rebase as 6:8f47515dda15) | |
447 | |/ | |
448 o / 1:112478962961 B | |
449 |/ | |
450 o 0:426bada5c675 A | |
451 | |
452 $ cd .. | |
453 | |
454 Rebase merge where successor of other parent is ancestor of destination | |
455 | |
456 $ hg init p2-succ-in-dest-b | |
457 $ cd p2-succ-in-dest-b | |
458 | |
459 $ hg debugdrawdag <<EOF | |
460 > F C | |
461 > /| | | |
462 > E D B # replace: D -> B | |
463 > \|/ | |
464 > A | |
465 > EOF | |
466 1 new orphan changesets | |
467 | |
468 $ hg rebase -d C -b F | |
469 note: not rebasing 2:b18e25de2cf5 D "D", already in destination as 1:112478962961 B "B" | |
470 rebasing 3:7fb047a69f22 E "E" | |
471 rebasing 5:66f1a38021c9 F tip "F" | |
472 note: not rebasing 5:66f1a38021c9 F tip "F", its destination already has all its changes | |
473 | |
474 $ hg log -G | |
475 o 6:533690786a86 E | |
476 | | |
477 | x 5:66f1a38021c9 F (pruned using rebase) | |
478 | |\ | |
479 o | | 4:26805aba1e60 C | |
480 | | | | |
481 | | x 3:7fb047a69f22 E (rewritten using rebase as 6:533690786a86) | |
482 | | | | |
483 | x | 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961) | |
484 | |/ | |
485 o / 1:112478962961 B | |
486 |/ | |
487 o 0:426bada5c675 A | |
488 | |
489 $ cd .. | |
490 | |
491 Rebase merge where extinct node has successor that is not an ancestor of | |
492 destination | |
493 | |
494 $ hg init extinct-with-succ-not-in-dest | |
495 $ cd extinct-with-succ-not-in-dest | |
496 | |
497 $ hg debugdrawdag <<EOF | |
498 > E C # replace: C -> E | |
499 > | | | |
500 > D B | |
501 > |/ | |
502 > A | |
503 > EOF | |
504 | |
505 $ hg rebase -d D -s B | |
506 rebasing 1:112478962961 B "B" | |
507 note: not rebasing 3:26805aba1e60 C "C" and its descendants as this would cause divergence | |
508 | |
509 $ cd .. | |
510 | |
511 $ hg init p2-succ-in-dest-c | |
512 $ cd p2-succ-in-dest-c | |
513 | |
514 The scenario here was that B::D were developed on default. B was queued on | |
515 stable, but amended before being push to hg-committed. C was queued on default, | |
516 along with unrelated J. | |
517 | |
518 $ hg debugdrawdag <<EOF | |
519 > J | |
520 > | | |
521 > F | |
522 > | | |
523 > E | |
524 > | D | |
525 > | | | |
526 > | C # replace: C -> F | |
527 > | | H I # replace: B -> H -> I | |
528 > | B |/ | |
529 > |/ G | |
530 > A | |
531 > EOF | |
532 1 new orphan changesets | |
533 | |
534 This strip seems to be the key to avoid an early divergence warning. | |
535 $ hg --config extensions.strip= --hidden strip -qr H | |
536 1 new orphan changesets | |
537 | |
538 $ hg rebase -b 'desc("D")' -d 'desc("J")' | |
539 abort: this rebase will cause divergences from: 112478962961 | |
540 (to force the rebase please set experimental.evolution.allowdivergence=True) | |
541 [20] | |
542 | |
543 Rebase merge where both parents have successors in destination | |
544 | |
545 $ hg init p12-succ-in-dest | |
546 $ cd p12-succ-in-dest | |
547 $ hg debugdrawdag <<'EOS' | |
548 > E F | |
549 > /| /| # replace: A -> C | |
550 > A B C D # replace: B -> D | |
551 > | | | |
552 > X Y | |
553 > EOS | |
554 1 new orphan changesets | |
555 $ hg rebase -r A+B+E -d F | |
556 note: not rebasing 4:a3d17304151f A "A", already in destination as 0:96cc3511f894 C "C" | |
557 note: not rebasing 5:b23a2cc00842 B "B", already in destination as 1:058c1e1fb10a D "D" | |
558 rebasing 7:dac5d11c5a7d E tip "E" | |
559 abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f | |
560 [10] | |
561 $ cd .. | |
562 | |
563 Rebase a non-clean merge. One parent has successor in destination, the other | |
564 parent moves as requested. | |
565 | |
566 $ hg init p1-succ-p2-move | |
567 $ cd p1-succ-p2-move | |
568 $ hg debugdrawdag <<'EOS' | |
569 > D Z | |
570 > /| | # replace: A -> C | |
571 > A B C # D/D = D | |
572 > EOS | |
573 1 new orphan changesets | |
574 $ hg rebase -r A+B+D -d Z | |
575 note: not rebasing 0:426bada5c675 A "A", already in destination as 2:96cc3511f894 C "C" | |
576 rebasing 1:fc2b737bb2e5 B "B" | |
577 rebasing 3:b8ed089c80ad D "D" | |
578 | |
579 $ rm .hg/localtags | |
580 $ hg log -G | |
581 o 6:e4f78693cc88 D | |
582 | | |
583 o 5:76840d832e98 B | |
584 | | |
585 o 4:50e41c1f3950 Z | |
586 | | |
587 o 2:96cc3511f894 C | |
588 | |
589 $ hg files -r tip | |
590 B | |
591 C | |
592 D | |
593 Z | |
594 | |
595 $ cd .. | |
596 | |
597 $ hg init p1-move-p2-succ | |
598 $ cd p1-move-p2-succ | |
599 $ hg debugdrawdag <<'EOS' | |
600 > D Z | |
601 > /| | # replace: B -> C | |
602 > A B C # D/D = D | |
603 > EOS | |
604 1 new orphan changesets | |
605 $ hg rebase -r B+A+D -d Z | |
606 rebasing 0:426bada5c675 A "A" | |
607 note: not rebasing 1:fc2b737bb2e5 B "B", already in destination as 2:96cc3511f894 C "C" | |
608 rebasing 3:b8ed089c80ad D "D" | |
609 | |
610 $ rm .hg/localtags | |
611 $ hg log -G | |
612 o 6:1b355ed94d82 D | |
613 | | |
614 o 5:a81a74d764a6 A | |
615 | | |
616 o 4:50e41c1f3950 Z | |
617 | | |
618 o 2:96cc3511f894 C | |
619 | |
620 $ hg files -r tip | |
621 A | |
622 C | |
623 D | |
624 Z | |
625 | |
626 $ cd .. |