Show More
@@ -598,6 +598,32 b' def _is_revision_affected_inner(' | |||
|
598 | 598 | |
|
599 | 599 | |
|
600 | 600 | def _is_revision_affected_fast(repo, fl, filerev, metadata_cache): |
|
601 | rl = fl._revlog | |
|
602 | is_censored = lambda: rl.iscensored(filerev) | |
|
603 | delta_base = lambda: rl.deltaparent(filerev) | |
|
604 | delta = lambda: rl._chunk(filerev) | |
|
605 | full_text = lambda: rl.rawdata(filerev) | |
|
606 | parent_revs = lambda: rl.parentrevs(filerev) | |
|
607 | return _is_revision_affected_fast_inner( | |
|
608 | is_censored, | |
|
609 | delta_base, | |
|
610 | delta, | |
|
611 | full_text, | |
|
612 | parent_revs, | |
|
613 | filerev, | |
|
614 | metadata_cache, | |
|
615 | ) | |
|
616 | ||
|
617 | ||
|
618 | def _is_revision_affected_fast_inner( | |
|
619 | is_censored, | |
|
620 | delta_base, | |
|
621 | delta, | |
|
622 | full_text, | |
|
623 | parent_revs, | |
|
624 | filerev, | |
|
625 | metadata_cache, | |
|
626 | ): | |
|
601 | 627 | """Optimization fast-path for `_is_revision_affected`. |
|
602 | 628 | |
|
603 | 629 | `metadata_cache` is a dict of `{rev: has_metadata}` which allows any |
@@ -605,24 +631,27 b' def _is_revision_affected_fast(repo, fl,' | |||
|
605 | 631 | text, instead looking at the current delta. |
|
606 | 632 | |
|
607 | 633 | This optimization only works if the revisions are looked at in order.""" |
|
608 | rl = fl._revlog | |
|
609 | 634 | |
|
610 |
if |
|
|
635 | if is_censored(): | |
|
611 | 636 | # Censored revisions don't contain metadata, so they cannot be affected |
|
612 | 637 | metadata_cache[filerev] = False |
|
613 | 638 | return False |
|
614 | 639 | |
|
615 |
p1, p2 = |
|
|
640 | p1, p2 = parent_revs() | |
|
616 | 641 | if p1 == nullrev or p2 != nullrev: |
|
617 | 642 | return False |
|
618 | 643 | |
|
619 |
delta_parent = |
|
|
644 | delta_parent = delta_base() | |
|
620 | 645 | parent_has_metadata = metadata_cache.get(delta_parent) |
|
621 | 646 | if parent_has_metadata is None: |
|
622 |
|
|
|
623 | return is_affected | |
|
647 | return _is_revision_affected_inner( | |
|
648 | full_text, | |
|
649 | parent_revs, | |
|
650 | filerev, | |
|
651 | metadata_cache, | |
|
652 | ) | |
|
624 | 653 | |
|
625 |
chunk = |
|
|
654 | chunk = delta() | |
|
626 | 655 | if not len(chunk): |
|
627 | 656 | # No diff for this revision |
|
628 | 657 | return parent_has_metadata |
@@ -636,7 +665,12 b' def _is_revision_affected_fast(repo, fl,' | |||
|
636 | 665 | if start < 2: # len(b'\x01\n') == 2 |
|
637 | 666 | # This delta does *something* to the metadata marker (if any). |
|
638 | 667 | # Check it the slow way |
|
639 |
is_affected = _is_revision_affected( |
|
|
668 | is_affected = _is_revision_affected_inner( | |
|
669 | full_text, | |
|
670 | parent_revs, | |
|
671 | filerev, | |
|
672 | metadata_cache, | |
|
673 | ) | |
|
640 | 674 | return is_affected |
|
641 | 675 | |
|
642 | 676 | # The diff did not remove or add the metadata header, it's then in the same |
General Comments 0
You need to be logged in to leave comments.
Login now