Mercurial > hg
comparison tests/test-revset.t @ 29769:abe4eecc3253
revset: resolve ambiguity of x^:y before alias expansion
This is purely a parsing problem, which should be resolved before alias
expansion.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 06 Aug 2016 20:21:00 +0900 |
parents | 8e4841944e68 |
children | 9c51a5de76db |
comparison
equal
deleted
inserted
replaced
29768:8e4841944e68 | 29769:abe4eecc3253 |
---|---|
480 | 480 |
481 infix/suffix resolution of ^ operator (issue2884): | 481 infix/suffix resolution of ^ operator (issue2884): |
482 | 482 |
483 x^:y means (x^):y | 483 x^:y means (x^):y |
484 | 484 |
485 $ try --optimize '1^:2' | 485 $ try '1^:2' |
486 (parent | |
487 ('symbol', '1') | |
488 (rangepre | |
489 ('symbol', '2'))) | |
490 * optimized: | |
491 (range | 486 (range |
492 (parentpost | 487 (parentpost |
493 ('symbol', '1')) | 488 ('symbol', '1')) |
494 ('symbol', '2')) | 489 ('symbol', '2')) |
495 * set: | 490 * set: |
496 <spanset+ 0:2> | 491 <spanset+ 0:2> |
497 0 | 492 0 |
498 1 | 493 1 |
499 2 | 494 2 |
500 | 495 |
501 $ try --optimize '1^::2' | 496 $ try '1^::2' |
502 (parent | |
503 ('symbol', '1') | |
504 (dagrangepre | |
505 ('symbol', '2'))) | |
506 * optimized: | |
507 (dagrange | 497 (dagrange |
508 (parentpost | 498 (parentpost |
509 ('symbol', '1')) | 499 ('symbol', '1')) |
510 ('symbol', '2')) | 500 ('symbol', '2')) |
511 * set: | 501 * set: |
514 1 | 504 1 |
515 2 | 505 2 |
516 | 506 |
517 x^:y should be resolved before omitting group operators | 507 x^:y should be resolved before omitting group operators |
518 | 508 |
519 $ try --optimize '1^(:2)' | 509 $ try '1^(:2)' |
520 (parent | 510 (parent |
521 ('symbol', '1') | 511 ('symbol', '1') |
522 (group | 512 (group |
523 (rangepre | 513 (rangepre |
524 ('symbol', '2')))) | 514 ('symbol', '2')))) |
525 * optimized: | |
526 (parent | |
527 ('symbol', '1') | |
528 (range | |
529 ('string', '0') | |
530 ('symbol', '2'))) | |
531 hg: parse error: ^ expects a number 0, 1, or 2 | 515 hg: parse error: ^ expects a number 0, 1, or 2 |
532 [255] | 516 [255] |
533 | 517 |
534 x^:y should be resolved recursively | 518 x^:y should be resolved recursively |
535 | 519 |
536 $ try --optimize 'sort(1^:2)' | 520 $ try 'sort(1^:2)' |
537 (func | |
538 ('symbol', 'sort') | |
539 (parent | |
540 ('symbol', '1') | |
541 (rangepre | |
542 ('symbol', '2')))) | |
543 * optimized: | |
544 (func | 521 (func |
545 ('symbol', 'sort') | 522 ('symbol', 'sort') |
546 (range | 523 (range |
547 (parentpost | 524 (parentpost |
548 ('symbol', '1')) | 525 ('symbol', '1')) |
551 <spanset+ 0:2> | 528 <spanset+ 0:2> |
552 0 | 529 0 |
553 1 | 530 1 |
554 2 | 531 2 |
555 | 532 |
556 $ try --optimize '(3^:4)^:2' | 533 $ try '(3^:4)^:2' |
557 (parent | |
558 (group | |
559 (parent | |
560 ('symbol', '3') | |
561 (rangepre | |
562 ('symbol', '4')))) | |
563 (rangepre | |
564 ('symbol', '2'))) | |
565 * optimized: | |
566 (range | 534 (range |
567 (parentpost | 535 (parentpost |
568 (range | 536 (group |
569 (parentpost | 537 (range |
570 ('symbol', '3')) | 538 (parentpost |
571 ('symbol', '4'))) | 539 ('symbol', '3')) |
540 ('symbol', '4')))) | |
572 ('symbol', '2')) | 541 ('symbol', '2')) |
573 * set: | 542 * set: |
574 <spanset+ 0:2> | 543 <spanset+ 0:2> |
575 0 | 544 0 |
576 1 | 545 1 |
577 2 | 546 2 |
578 | 547 |
579 $ try --optimize '(3^::4)^::2' | 548 $ try '(3^::4)^::2' |
580 (parent | |
581 (group | |
582 (parent | |
583 ('symbol', '3') | |
584 (dagrangepre | |
585 ('symbol', '4')))) | |
586 (dagrangepre | |
587 ('symbol', '2'))) | |
588 * optimized: | |
589 (dagrange | 549 (dagrange |
590 (parentpost | 550 (parentpost |
591 (dagrange | 551 (group |
592 (parentpost | 552 (dagrange |
593 ('symbol', '3')) | 553 (parentpost |
594 ('symbol', '4'))) | 554 ('symbol', '3')) |
555 ('symbol', '4')))) | |
595 ('symbol', '2')) | 556 ('symbol', '2')) |
596 * set: | 557 * set: |
597 <baseset+ [0, 1, 2]> | 558 <baseset+ [0, 1, 2]> |
598 0 | 559 0 |
599 1 | 560 1 |
600 2 | 561 2 |
601 | 562 |
602 x^ in alias should also be resolved | 563 x^ in alias should also be resolved |
603 | 564 |
604 $ try --optimize 'A' --config 'revsetalias.A=1^:2' | 565 $ try 'A' --config 'revsetalias.A=1^:2' |
605 ('symbol', 'A') | 566 ('symbol', 'A') |
606 * expanded: | 567 * expanded: |
607 (parent | |
608 ('symbol', '1') | |
609 (rangepre | |
610 ('symbol', '2'))) | |
611 * optimized: | |
612 (range | 568 (range |
613 (parentpost | 569 (parentpost |
614 ('symbol', '1')) | 570 ('symbol', '1')) |
615 ('symbol', '2')) | 571 ('symbol', '2')) |
616 * set: | 572 * set: |
617 <spanset+ 0:2> | 573 <spanset+ 0:2> |
618 0 | 574 0 |
619 1 | 575 1 |
620 2 | 576 2 |
621 | 577 |
622 $ try --optimize 'A:2' --config 'revsetalias.A=1^' | 578 $ try 'A:2' --config 'revsetalias.A=1^' |
623 (range | 579 (range |
624 ('symbol', 'A') | 580 ('symbol', 'A') |
625 ('symbol', '2')) | 581 ('symbol', '2')) |
626 * expanded: | 582 * expanded: |
627 (range | 583 (range |
628 (parentpost | 584 (parentpost |
629 ('symbol', '1')) | 585 ('symbol', '1')) |
630 ('symbol', '2')) | 586 ('symbol', '2')) |
631 * optimized: | |
632 (range | |
633 (parentpost | |
634 ('symbol', '1')) | |
635 ('symbol', '2')) | |
636 * set: | 587 * set: |
637 <spanset+ 0:2> | 588 <spanset+ 0:2> |
638 0 | 589 0 |
639 1 | 590 1 |
640 2 | 591 2 |
641 | 592 |
642 but not beyond the boundary of alias expansion, because the resolution should | 593 but not beyond the boundary of alias expansion, because the resolution should |
643 be made at the parsing stage | 594 be made at the parsing stage |
644 | 595 |
645 $ try --optimize '1^A' --config 'revsetalias.A=:2' | 596 $ try '1^A' --config 'revsetalias.A=:2' |
646 (parent | 597 (parent |
647 ('symbol', '1') | 598 ('symbol', '1') |
648 ('symbol', 'A')) | 599 ('symbol', 'A')) |
649 * expanded: | 600 * expanded: |
650 (parent | 601 (parent |
651 ('symbol', '1') | 602 ('symbol', '1') |
652 (rangepre | 603 (rangepre |
653 ('symbol', '2'))) | 604 ('symbol', '2'))) |
654 * optimized: | 605 hg: parse error: ^ expects a number 0, 1, or 2 |
655 (range | 606 [255] |
656 (parentpost | |
657 ('symbol', '1')) | |
658 ('symbol', '2')) | |
659 * set: | |
660 <spanset+ 0:2> | |
661 0 | |
662 1 | |
663 2 | |
664 BROKEN: should be parsed as '1^(:2)' | |
665 | 607 |
666 ancestor can accept 0 or more arguments | 608 ancestor can accept 0 or more arguments |
667 | 609 |
668 $ log 'ancestor()' | 610 $ log 'ancestor()' |
669 $ log 'ancestor(1)' | 611 $ log 'ancestor(1)' |