Mercurial > hg
comparison tests/test-stabletailgraph.t @ 50528:8fb3e942473a
stabletailgraph: naive version of leap computation
This adds a naive reference implementation of the computation of leap and
specific leap sets (described in the code documentation).
The existing tests are enriched accordingly.
author | pacien <pacien.trangirard@pacien.net> |
---|---|
date | Fri, 21 Apr 2023 14:33:33 +0200 |
parents | e06331275a53 |
children | 027481f19944 |
comparison
equal
deleted
inserted
replaced
50527:dc372251d4dc | 50528:8fb3e942473a |
---|---|
6 non-trivial structure, on which the various stable-tail graph and stable-tail | 6 non-trivial structure, on which the various stable-tail graph and stable-tail |
7 sort functions are tested. | 7 sort functions are tested. |
8 | 8 |
9 Each case consists of the creation of the interesting graph structure, followed | 9 Each case consists of the creation of the interesting graph structure, followed |
10 by a check, for each noteworthy node, of: | 10 by a check, for each noteworthy node, of: |
11 - the stable-tail sort output (with the linear parts globbed). | 11 - the stable-tail sort output (with the linear parts globbed), |
12 - the leap set, | |
13 - the specific leap set. | |
12 | 14 |
13 In the ASCII art of the diagrams, the side of the exclusive part which is | 15 In the ASCII art of the diagrams, the side of the exclusive part which is |
14 followed in priority is denoted with "<" or ">" if it is on the left or right | 16 followed in priority is denoted with "<" or ">" if it is on the left or right |
15 respectively. | 17 respectively. |
16 | 18 |
27 > [format] | 29 > [format] |
28 > exp-use-changelog-v2=enable-unstable-format-and-corrupt-my-data | 30 > exp-use-changelog-v2=enable-unstable-format-and-corrupt-my-data |
29 > | 31 > |
30 > [alias] | 32 > [alias] |
31 > test-sts = debug::stable-tail-sort -T '{tags},' | 33 > test-sts = debug::stable-tail-sort -T '{tags},' |
34 > test-leaps = debug::stable-tail-sort-leaps -T '{tags}' | |
32 > test-log = log --graph -T '{tags} rank={_fast_rank}' --rev 'tagged()' | 35 > test-log = log --graph -T '{tags} rank={_fast_rank}' --rev 'tagged()' |
33 > EOF | 36 > EOF |
34 | 37 |
35 | 38 |
36 Example 1: single merge node | 39 Example 1: single merge node |
84 | 87 |
85 Check that the linear descendant of the merge inherits its sort properly. | 88 Check that the linear descendant of the merge inherits its sort properly. |
86 | 89 |
87 $ hg test-sts f | 90 $ hg test-sts f |
88 f,e,c,d,*,b,a, (no-eol) (glob) | 91 f,e,c,d,*,b,a, (no-eol) (glob) |
92 | |
93 Check the leaps of "e": arriving at "c", the sort continues at "d", which | |
94 which breaks the child-parent chain and results in a leap. | |
95 | |
96 $ hg test-leaps e | |
97 cd | |
98 | |
99 Check that this leap is indeed specific to "e", i.e. that it appears in its | |
100 stable-tail sort, but not in any stable-tail sort of its ancestors. | |
101 | |
102 $ hg test-leaps --specific e | |
103 | |
104 Check that this leap is inherited by its direct ancestor "f". | |
105 | |
106 $ hg test-leaps f | |
107 cd | |
108 | |
109 Check that this leap is not classified as specific to "f", since it is specific | |
110 to "e". | |
111 | |
112 $ hg test-leaps --specific f | |
89 | 113 |
90 $ cd .. | 114 $ cd .. |
91 | 115 |
92 | 116 |
93 Example 2: nested exclusive parts, without specific leap | 117 Example 2: nested exclusive parts, without specific leap |
144 and that a part of the sort of "e" appears as an infix. | 168 and that a part of the sort of "e" appears as an infix. |
145 | 169 |
146 $ hg test-sts g | 170 $ hg test-sts g |
147 g,e,c,d,*,b,f,*,a, (no-eol) (glob) | 171 g,e,c,d,*,b,f,*,a, (no-eol) (glob) |
148 | 172 |
173 Check the leaps of "e". | |
174 | |
175 $ hg test-leaps e | |
176 cd | |
177 | |
178 $ hg test-leaps --specific e | |
179 | |
180 Check that "g" inherits a leap from "e" in addition of its own. | |
181 | |
182 $ hg test-leaps g | |
183 cd | |
184 bf | |
185 | |
186 Check that only the additional leap of "g" is classified as specific. | |
187 | |
188 $ hg test-leaps --specific g | |
189 | |
149 $ cd .. | 190 $ cd .. |
150 | 191 |
151 | 192 |
152 Example 3: shadowing of a final leap | 193 Example 3: shadowing of a final leap |
153 ==================================== | 194 ==================================== |
203 and that "c" is then emitted after "e" (its descendant). | 244 and that "c" is then emitted after "e" (its descendant). |
204 | 245 |
205 $ hg test-sts f | 246 $ hg test-sts f |
206 f,d,b,e,*,c,*,a, (no-eol) (glob) | 247 f,d,b,e,*,c,*,a, (no-eol) (glob) |
207 | 248 |
249 Check the leaps of "d". | |
250 | |
251 $ hg test-leaps d | |
252 bc | |
253 | |
254 $ hg test-leaps --specific d | |
255 | |
256 Check thet leaps of "f", which, despite being a descendant of "f", has a | |
257 different stable-tail sort which does not reuse any leap of "d". | |
258 | |
259 $ hg test-leaps f | |
260 be | |
261 | |
262 $ hg test-leaps --specific f | |
263 | |
208 $ cd .. | 264 $ cd .. |
209 | 265 |
210 | 266 |
211 Example 4: skipping over nested exclusive part (entirely) | 267 Example 4: skipping over nested exclusive part (entirely) |
212 ========================================================= | 268 ========================================================= |
260 | 316 |
261 Check that sort "f" leaps from "d" to "b": | 317 Check that sort "f" leaps from "d" to "b": |
262 | 318 |
263 $ hg test-sts f | 319 $ hg test-sts f |
264 f,d,b,*,e,*,c,a, (no-eol) (glob) | 320 f,d,b,*,e,*,c,a, (no-eol) (glob) |
321 | |
322 Check the leaps of "d". | |
323 | |
324 $ hg test-leaps d | |
325 cb | |
326 | |
327 $ hg test-leaps --specific d | |
328 | |
329 Check the leaps of "f". | |
330 | |
331 $ hg test-leaps f | |
332 db | |
333 e* (glob) | |
334 | |
335 $ hg test-leaps --specific f | |
336 db | |
265 | 337 |
266 $ cd .. | 338 $ cd .. |
267 | 339 |
268 | 340 |
269 Example 5: skipping over nested exclusive part (partially) | 341 Example 5: skipping over nested exclusive part (partially) |
320 Check that sort "f" leaps from "g" to "b": | 392 Check that sort "f" leaps from "g" to "b": |
321 | 393 |
322 $ hg test-sts f | 394 $ hg test-sts f |
323 f,d,g,b,*,e,*,c,a, (no-eol) (glob) | 395 f,d,g,b,*,e,*,c,a, (no-eol) (glob) |
324 | 396 |
397 Check the leaps of "d". | |
398 | |
399 $ hg test-leaps d | |
400 cb | |
401 $ hg test-leaps --specific d | |
402 | |
403 Check the leaps of "f". | |
404 | |
405 $ hg test-leaps f | |
406 gb | |
407 e* (glob) | |
408 | |
409 $ hg test-leaps --specific f | |
410 gb | |
411 | |
325 $ cd .. | 412 $ cd .. |
326 | 413 |
327 | 414 |
328 Example 6: merge in the inherited part | 415 Example 6: merge in the inherited part |
329 ====================================== | 416 ====================================== |
378 Check that the sort of "g" delegates to the sort of "f" after processing its | 465 Check that the sort of "g" delegates to the sort of "f" after processing its |
379 exclusive part of "g": | 466 exclusive part of "g": |
380 | 467 |
381 $ hg test-sts g | 468 $ hg test-sts g |
382 g,d,f,e,b,c,*,a, (no-eol) (glob) | 469 g,d,f,e,b,c,*,a, (no-eol) (glob) |
470 | |
471 Check the leaps of "f". | |
472 | |
473 $ hg test-leaps f | |
474 bc | |
475 | |
476 $ hg test-leaps --specific f | |
477 | |
478 Check the leaps of "g". | |
479 | |
480 $ hg test-leaps g | |
481 df | |
482 bc | |
483 | |
484 $ hg test-leaps --specific g | |
383 | 485 |
384 $ cd .. | 486 $ cd .. |
385 | 487 |
386 | 488 |
387 Example 7: postponed iteration of common exclusive ancestors | 489 Example 7: postponed iteration of common exclusive ancestors |
459 Check that the common part of excl(j) and excl(k) is iterated over after "k": | 561 Check that the common part of excl(j) and excl(k) is iterated over after "k": |
460 | 562 |
461 $ hg test-sts l | 563 $ hg test-sts l |
462 l,j,e,g,*,f,k,h,*,d,c,b,i,*,a, (no-eol) (glob) | 564 l,j,e,g,*,f,k,h,*,d,c,b,i,*,a, (no-eol) (glob) |
463 | 565 |
566 Check the leaps of "j". | |
567 | |
568 $ hg test-leaps j | |
569 cg | |
570 | |
571 $ hg test-leaps --specific j | |
572 | |
573 Check the leaps of "k". | |
574 | |
575 $ hg test-leaps k | |
576 bi | |
577 | |
578 $ hg test-leaps --specific k | |
579 | |
580 Check the leaps of "l". | |
581 | |
582 $ hg test-leaps l | |
583 eg | |
584 fk | |
585 bi | |
586 | |
587 $ hg test-leaps --specific l | |
588 eg | |
589 | |
464 $ cd .. | 590 $ cd .. |
465 | 591 |
466 | 592 |
467 Example 8: postponed iteration of common ancestors between parts | 593 Example 8: postponed iteration of common ancestors between parts |
468 ================================================================ | 594 ================================================================ |
532 Check that the common part of inherited(g) and excl(k) is iterated over after | 658 Check that the common part of inherited(g) and excl(k) is iterated over after |
533 "i": | 659 "i": |
534 | 660 |
535 $ hg test-sts j | 661 $ hg test-sts j |
536 j,g,c,f,i,e,d,b,h,*,a, (no-eol) (glob) | 662 j,g,c,f,i,e,d,b,h,*,a, (no-eol) (glob) |
663 | |
664 Check the leaps of "g". | |
665 | |
666 $ hg test-leaps g | |
667 cf | |
668 $ hg test-leaps g | |
669 cf | |
670 | |
671 Check the leaps of "i". | |
672 | |
673 $ hg test-leaps i | |
674 bh | |
675 | |
676 $ hg test-leaps --specific i | |
677 | |
678 Check the leaps of "j". | |
679 | |
680 $ hg test-leaps j | |
681 cf | |
682 fi | |
683 bh | |
684 | |
685 $ hg test-leaps --specific j | |
537 | 686 |
538 $ cd .. | 687 $ cd .. |
539 | 688 |
540 | 689 |
541 Example 9: postponed iteration of common ancestors between both parts | 690 Example 9: postponed iteration of common ancestors between both parts |
611 is postponed to inherited(j) in sort(k): | 760 is postponed to inherited(j) in sort(k): |
612 | 761 |
613 $ hg test-sts k | 762 $ hg test-sts k |
614 k,i,c,f,e,j,g,*,b,h,*,d,a, (no-eol) (glob) | 763 k,i,c,f,e,j,g,*,b,h,*,d,a, (no-eol) (glob) |
615 | 764 |
616 $ cd .. | 765 Check the leaps of "i". |
766 | |
767 $ hg test-leaps i | |
768 bf | |
769 | |
770 $ hg test-leaps --specific i | |
771 | |
772 Check the leaps of "j". | |
773 | |
774 $ hg test-leaps j | |
775 bh | |
776 | |
777 $ hg test-leaps --specific j | |
778 | |
779 Check the leaps of "k". | |
780 | |
781 $ hg test-leaps k | |
782 cf | |
783 ej | |
784 bh | |
785 | |
786 $ hg test-leaps --specific k | |
787 cf | |
788 | |
789 $ cd .. |