comparison tests/test-annotate.t @ 32063:befefdd34cf8 stable

context: start walking from "introrev" in blockancestors() Previously, calling blockancestors() with a fctx not touching file would sometimes yield this filectx first, instead of the first "block ancestor", because when compared to its parent it may have changes in specified line range despite not touching the file at all. Fixing this by starting the algorithm from the "base" filectx obtained using fctx.introrev() (as done in annotate()). In tests, add a changeset not touching file we want to follow lines of to cover this case. Do this in test-annotate.t for followlines revset tests and in test-hgweb-filelog.t for /log/<rev>/<file>?linerange=<from>:<to> tests.
author Denis Laxalde <denis@laxalde.org>
date Thu, 20 Apr 2017 21:40:28 +0200
parents 83527d9f1f13
children 2a2744dffecf
comparison
equal deleted inserted replaced
32062:ad6c5497cd15 32063:befefdd34cf8
486 486
487 Test followlines() revset; we usually check both followlines(pat, range) and 487 Test followlines() revset; we usually check both followlines(pat, range) and
488 followlines(pat, range, descend=True) to make sure both give the same result 488 followlines(pat, range, descend=True) to make sure both give the same result
489 when they should. 489 when they should.
490 490
491 $ echo a >> foo
492 $ hg ci -m 'foo: add a'
491 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5)' 493 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5)'
492 16: baz:0 494 16: baz:0
493 19: baz:3 495 19: baz:3
494 20: baz:4 496 20: baz:4
495 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=20)' 497 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=20)'
526 $ hg ci -m 'baz:3->3+' 528 $ hg ci -m 'baz:3->3+'
527 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, descend=0)' 529 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, descend=0)'
528 16: baz:0 530 16: baz:0
529 19: baz:3 531 19: baz:3
530 20: baz:4 532 20: baz:4
531 23: baz:3->3+ 533 24: baz:3->3+
532 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=17, descend=True)' 534 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=17, descend=True)'
533 19: baz:3 535 19: baz:3
534 20: baz:4 536 20: baz:4
535 23: baz:3->3+ 537 24: baz:3->3+
536 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1:2, descend=false)' 538 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1:2, descend=false)'
537 21: added two lines with 0 539 22: added two lines with 0
538 540
539 file patterns are okay 541 file patterns are okay
540 $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1:2)' 542 $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1:2)'
541 21: added two lines with 0 543 22: added two lines with 0
542 544
543 renames are followed 545 renames are followed
544 $ hg mv baz qux 546 $ hg mv baz qux
545 $ sed 's/4/4+/' qux > qux.new 547 $ sed 's/4/4+/' qux > qux.new
546 $ mv qux.new qux 548 $ mv qux.new qux
547 $ hg ci -m 'qux:4->4+' 549 $ hg ci -m 'qux:4->4+'
548 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)' 550 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
549 16: baz:0 551 16: baz:0
550 19: baz:3 552 19: baz:3
551 20: baz:4 553 20: baz:4
552 23: baz:3->3+ 554 24: baz:3->3+
553 24: qux:4->4+ 555 25: qux:4->4+
554 556
555 but are missed when following children 557 but are missed when following children
556 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=22, descend=True)' 558 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=22, descend=True)'
557 23: baz:3->3+ 559 24: baz:3->3+
558 560
559 merge 561 merge
560 $ hg up 23 --quiet 562 $ hg up 24 --quiet
561 $ echo 7 >> baz 563 $ echo 7 >> baz
562 $ hg ci -m 'one more line, out of line range' 564 $ hg ci -m 'one more line, out of line range'
563 created new head 565 created new head
564 $ sed 's/3+/3-/' baz > baz.new 566 $ sed 's/3+/3-/' baz > baz.new
565 $ mv baz.new baz 567 $ mv baz.new baz
566 $ hg ci -m 'baz:3+->3-' 568 $ hg ci -m 'baz:3+->3-'
567 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)' 569 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
568 16: baz:0 570 16: baz:0
569 19: baz:3 571 19: baz:3
570 20: baz:4 572 20: baz:4
571 23: baz:3->3+ 573 24: baz:3->3+
572 26: baz:3+->3- 574 27: baz:3+->3-
573 $ hg merge 24 575 $ hg merge 25
574 merging baz and qux to qux 576 merging baz and qux to qux
575 0 files updated, 1 files merged, 0 files removed, 0 files unresolved 577 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
576 (branch merge, don't forget to commit) 578 (branch merge, don't forget to commit)
577 $ hg ci -m merge 579 $ hg ci -m merge
578 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)' 580 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
579 16: baz:0 581 16: baz:0
580 19: baz:3 582 19: baz:3
581 20: baz:4 583 20: baz:4
582 23: baz:3->3+ 584 24: baz:3->3+
583 24: qux:4->4+ 585 25: qux:4->4+
584 26: baz:3+->3- 586 27: baz:3+->3-
585 27: merge 587 28: merge
586 $ hg up 24 --quiet 588 $ hg up 25 --quiet
587 $ hg merge 26 589 $ hg merge 27
588 merging qux and baz to qux 590 merging qux and baz to qux
589 0 files updated, 1 files merged, 0 files removed, 0 files unresolved 591 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
590 (branch merge, don't forget to commit) 592 (branch merge, don't forget to commit)
591 $ hg ci -m 'merge from other side' 593 $ hg ci -m 'merge from other side'
592 created new head 594 created new head
593 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)' 595 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
594 16: baz:0 596 16: baz:0
595 19: baz:3 597 19: baz:3
596 20: baz:4 598 20: baz:4
597 23: baz:3->3+ 599 24: baz:3->3+
598 24: qux:4->4+ 600 25: qux:4->4+
599 26: baz:3+->3- 601 27: baz:3+->3-
600 28: merge from other side 602 29: merge from other side
603 $ hg up 24 --quiet
604
605 we are missing the branch with rename when following children
606 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=26, descend=True)'
607 27: baz:3+->3-
608
609 we follow all branches in descending direction
601 $ hg up 23 --quiet 610 $ hg up 23 --quiet
602
603 we are missing the branch with rename when following children
604 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=25, descend=True)'
605 26: baz:3+->3-
606
607 we follow all branches in descending direction
608 $ hg up 22 --quiet
609 $ sed 's/3/+3/' baz > baz.new 611 $ sed 's/3/+3/' baz > baz.new
610 $ mv baz.new baz 612 $ mv baz.new baz
611 $ hg ci -m 'baz:3->+3' 613 $ hg ci -m 'baz:3->+3'
612 created new head 614 created new head
613 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 2:5, startrev=16, descend=True)' --graph 615 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 2:5, startrev=16, descend=True)' --graph
614 @ 29: baz:3->+3 616 @ 30: baz:3->+3
615 : 617 :
616 : o 26: baz:3+->3- 618 : o 27: baz:3+->3-
617 : : 619 : :
618 : o 23: baz:3->3+ 620 : o 24: baz:3->3+
619 :/ 621 :/
620 o 20: baz:4 622 o 20: baz:4
621 |\ 623 |\
622 | o 19: baz:3 624 | o 19: baz:3
623 |/ 625 |/
626 o 16: baz:0 628 o 16: baz:0
627 | 629 |
628 ~ 630 ~
629 631
630 check error cases 632 check error cases
631 $ hg up 23 --quiet 633 $ hg up 24 --quiet
632 $ hg log -r 'followlines()' 634 $ hg log -r 'followlines()'
633 hg: parse error: followlines takes at least 1 positional arguments 635 hg: parse error: followlines takes at least 1 positional arguments
634 [255] 636 [255]
635 $ hg log -r 'followlines(baz)' 637 $ hg log -r 'followlines(baz)'
636 hg: parse error: followlines requires a line range 638 hg: parse error: followlines requires a line range