comparison tests/test-annotate.t @ 30804:4227f80f72b2

revset: abuse x:y syntax to specify line range of followlines() This slightly complicates the parsing (see the previous patch), but the overall result seems not bad. I keep x:, :y and : for future extension.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 09 Jan 2017 17:58:19 +0900
parents cd23879cbac7
children 5e3b49defbff
comparison
equal deleted inserted replaced
30803:d389f19f14aa 30804:4227f80f72b2
484 $ hg id -n 484 $ hg id -n
485 20 485 20
486 486
487 Test followlines() revset 487 Test followlines() revset
488 488
489 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3, 5)' 489 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5)'
490 16: baz:0 490 16: baz:0
491 19: baz:3 491 19: baz:3
492 20: baz:4 492 20: baz:4
493 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3, 5, startrev=20)' 493 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=20)'
494 16: baz:0 494 16: baz:0
495 19: baz:3 495 19: baz:3
496 20: baz:4 496 20: baz:4
497 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3, 5, startrev=.^)' 497 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=.^)'
498 16: baz:0 498 16: baz:0
499 19: baz:3 499 19: baz:3
500 $ printf "0\n0\n" | cat - baz > baz1 500 $ printf "0\n0\n" | cat - baz > baz1
501 $ mv baz1 baz 501 $ mv baz1 baz
502 $ hg ci -m 'added two lines with 0' 502 $ hg ci -m 'added two lines with 0'
503 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5, 7)' 503 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
504 16: baz:0 504 16: baz:0
505 19: baz:3 505 19: baz:3
506 20: baz:4 506 20: baz:4
507 $ echo 6 >> baz 507 $ echo 6 >> baz
508 $ hg ci -m 'added line 8' 508 $ hg ci -m 'added line 8'
509 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5, 7)' 509 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
510 16: baz:0 510 16: baz:0
511 19: baz:3 511 19: baz:3
512 20: baz:4 512 20: baz:4
513 $ sed 's/3/3+/' baz > baz.new 513 $ sed 's/3/3+/' baz > baz.new
514 $ mv baz.new baz 514 $ mv baz.new baz
515 $ hg ci -m 'baz:3->3+' 515 $ hg ci -m 'baz:3->3+'
516 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5, 7)' 516 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
517 16: baz:0 517 16: baz:0
518 19: baz:3 518 19: baz:3
519 20: baz:4 519 20: baz:4
520 23: baz:3->3+ 520 23: baz:3->3+
521 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1, 2)' 521 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1:2)'
522 21: added two lines with 0 522 21: added two lines with 0
523 523
524 file patterns are okay 524 file patterns are okay
525 $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1, 2)' 525 $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1:2)'
526 21: added two lines with 0 526 21: added two lines with 0
527 527
528 renames are followed 528 renames are followed
529 $ hg mv baz qux 529 $ hg mv baz qux
530 $ sed 's/4/4+/' qux > qux.new 530 $ sed 's/4/4+/' qux > qux.new
531 $ mv qux.new qux 531 $ mv qux.new qux
532 $ hg ci -m 'qux:4->4+' 532 $ hg ci -m 'qux:4->4+'
533 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5, 7)' 533 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
534 16: baz:0 534 16: baz:0
535 19: baz:3 535 19: baz:3
536 20: baz:4 536 20: baz:4
537 23: baz:3->3+ 537 23: baz:3->3+
538 24: qux:4->4+ 538 24: qux:4->4+
543 $ hg ci -m 'one more line, out of line range' 543 $ hg ci -m 'one more line, out of line range'
544 created new head 544 created new head
545 $ sed 's/3+/3-/' baz > baz.new 545 $ sed 's/3+/3-/' baz > baz.new
546 $ mv baz.new baz 546 $ mv baz.new baz
547 $ hg ci -m 'baz:3+->3-' 547 $ hg ci -m 'baz:3+->3-'
548 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5, 7)' 548 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
549 16: baz:0 549 16: baz:0
550 19: baz:3 550 19: baz:3
551 20: baz:4 551 20: baz:4
552 23: baz:3->3+ 552 23: baz:3->3+
553 26: baz:3+->3- 553 26: baz:3+->3-
554 $ hg merge 24 554 $ hg merge 24
555 merging baz and qux to qux 555 merging baz and qux to qux
556 0 files updated, 1 files merged, 0 files removed, 0 files unresolved 556 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
557 (branch merge, don't forget to commit) 557 (branch merge, don't forget to commit)
558 $ hg ci -m merge 558 $ hg ci -m merge
559 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5, 7)' 559 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
560 16: baz:0 560 16: baz:0
561 19: baz:3 561 19: baz:3
562 20: baz:4 562 20: baz:4
563 23: baz:3->3+ 563 23: baz:3->3+
564 24: qux:4->4+ 564 24: qux:4->4+
569 merging qux and baz to qux 569 merging qux and baz to qux
570 0 files updated, 1 files merged, 0 files removed, 0 files unresolved 570 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
571 (branch merge, don't forget to commit) 571 (branch merge, don't forget to commit)
572 $ hg ci -m 'merge from other side' 572 $ hg ci -m 'merge from other side'
573 created new head 573 created new head
574 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5, 7)' 574 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
575 16: baz:0 575 16: baz:0
576 19: baz:3 576 19: baz:3
577 20: baz:4 577 20: baz:4
578 23: baz:3->3+ 578 23: baz:3->3+
579 24: qux:4->4+ 579 24: qux:4->4+
584 check error cases 584 check error cases
585 $ hg log -r 'followlines()' 585 $ hg log -r 'followlines()'
586 hg: parse error: followlines takes at least 1 positional arguments 586 hg: parse error: followlines takes at least 1 positional arguments
587 [255] 587 [255]
588 $ hg log -r 'followlines(baz)' 588 $ hg log -r 'followlines(baz)'
589 hg: parse error: followlines takes at least three arguments 589 hg: parse error: followlines requires a line range
590 [255] 590 [255]
591 $ hg log -r 'followlines(baz, 1)' 591 $ hg log -r 'followlines(baz, 1)'
592 hg: parse error: followlines takes at least three arguments 592 hg: parse error: followlines expects a line range
593 [255] 593 [255]
594 $ hg log -r 'followlines(baz, 1, 2, startrev=desc("b"))' 594 $ hg log -r 'followlines(baz, 1:2, startrev=desc("b"))'
595 hg: parse error: followlines expects exactly one revision 595 hg: parse error: followlines expects exactly one revision
596 [255] 596 [255]
597 $ hg log -r 'followlines("glob:*", 1, 2)' 597 $ hg log -r 'followlines("glob:*", 1:2)'
598 hg: parse error: followlines expects exactly one file 598 hg: parse error: followlines expects exactly one file
599 [255] 599 [255]
600 $ hg log -r 'followlines(baz, x, 4)' 600 $ hg log -r 'followlines(baz, 1:)'
601 hg: parse error: line range bounds must be integers 601 hg: parse error: line range bounds must be integers
602 [255] 602 [255]
603 $ hg log -r 'followlines(baz, 5, 4)' 603 $ hg log -r 'followlines(baz, :1)'
604 hg: parse error: line range bounds must be integers
605 [255]
606 $ hg log -r 'followlines(baz, x:4)'
607 hg: parse error: line range bounds must be integers
608 [255]
609 $ hg log -r 'followlines(baz, 5:4)'
604 hg: parse error: line range must be positive 610 hg: parse error: line range must be positive
605 [255] 611 [255]
606 $ hg log -r 'followlines(baz, 0, 4)' 612 $ hg log -r 'followlines(baz, 0:4)'
607 hg: parse error: fromline must be strictly positive 613 hg: parse error: fromline must be strictly positive
608 [255] 614 [255]
609 $ hg log -r 'followlines(baz, 2, 40)' 615 $ hg log -r 'followlines(baz, 2:40)'
610 abort: line range exceeds file size 616 abort: line range exceeds file size
611 [255] 617 [255]
612 618
613 Test annotate with whitespace options 619 Test annotate with whitespace options
614 620