Show More
@@ -712,7 +712,7 b' class basefilectx(object):' | |||
|
712 | 712 | |
|
713 | 713 | return True |
|
714 | 714 | |
|
715 | def _adjustlinkrev(self, srcrev, inclusive=False): | |
|
715 | def _adjustlinkrev(self, srcrev, inclusive=False, stoprev=None): | |
|
716 | 716 | """return the first ancestor of <srcrev> introducing <fnode> |
|
717 | 717 | |
|
718 | 718 | If the linkrev of the file revision does not point to an ancestor of |
@@ -721,6 +721,10 b' class basefilectx(object):' | |||
|
721 | 721 | |
|
722 | 722 | :srcrev: the changeset revision we search ancestors from |
|
723 | 723 | :inclusive: if true, the src revision will also be checked |
|
724 | :stoprev: an optional revision to stop the walk at. If no introduction | |
|
725 | of this file content could be found before this floor | |
|
726 | revision, the function will returns "None" and stops its | |
|
727 | iteration. | |
|
724 | 728 | """ |
|
725 | 729 | repo = self._repo |
|
726 | 730 | cl = repo.unfiltered().changelog |
@@ -748,6 +752,8 b' class basefilectx(object):' | |||
|
748 | 752 | fnode = self._filenode |
|
749 | 753 | path = self._path |
|
750 | 754 | for a in iteranc: |
|
755 | if stoprev is not None and a < stoprev: | |
|
756 | return None | |
|
751 | 757 | ac = cl.read(a) # get changeset data (we avoid object creation) |
|
752 | 758 | if path in ac[3]: # checking the 'files' field. |
|
753 | 759 | # The file has been touched, check if the content is |
@@ -765,7 +771,9 b' class basefilectx(object):' | |||
|
765 | 771 | """ |
|
766 | 772 | if self.linkrev() >= changelogrev: |
|
767 | 773 | return True |
|
768 | introrev = self._introrev() | |
|
774 | introrev = self._introrev(stoprev=changelogrev) | |
|
775 | if introrev is None: | |
|
776 | return False | |
|
769 | 777 | return introrev >= changelogrev |
|
770 | 778 | |
|
771 | 779 | def introrev(self): |
@@ -779,7 +787,15 b' class basefilectx(object):' | |||
|
779 | 787 | """ |
|
780 | 788 | return self._introrev() |
|
781 | 789 | |
|
782 | def _introrev(self): | |
|
790 | def _introrev(self, stoprev=None): | |
|
791 | """ | |
|
792 | Same as `introrev` but, with an extra argument to limit changelog | |
|
793 | iteration range in some internal usecase. | |
|
794 | ||
|
795 | If `stoprev` is set, the `introrev` will not be searched past that | |
|
796 | `stoprev` revision and "None" might be returned. This is useful to | |
|
797 | limit the iteration range. | |
|
798 | """ | |
|
783 | 799 | toprev = None |
|
784 | 800 | attrs = vars(self) |
|
785 | 801 | if r'_changeid' in attrs: |
@@ -790,11 +806,12 b' class basefilectx(object):' | |||
|
790 | 806 | toprev = self._changectx.rev() |
|
791 | 807 | |
|
792 | 808 | if toprev is not None: |
|
793 | return self._adjustlinkrev(toprev, inclusive=True) | |
|
809 | return self._adjustlinkrev(toprev, inclusive=True, stoprev=stoprev) | |
|
794 | 810 | elif r'_descendantrev' in attrs: |
|
795 | introrev = self._adjustlinkrev(self._descendantrev) | |
|
811 | introrev = self._adjustlinkrev(self._descendantrev, stoprev=stoprev) | |
|
796 | 812 | # be nice and cache the result of the computation |
|
797 |
|
|
|
813 | if introrev is not None: | |
|
814 | self._changeid = introrev | |
|
798 | 815 | return introrev |
|
799 | 816 | else: |
|
800 | 817 | return self.linkrev() |
General Comments 0
You need to be logged in to leave comments.
Login now