##// END OF EJS Templates
context: floor adjustlinkrev graph walk during copy tracing...
Boris Feld -
r40733:d98fb3f4 default
parent child Browse files
Show More
@@ -712,7 +712,7 b' class basefilectx(object):'
712
712
713 return True
713 return True
714
714
715 def _adjustlinkrev(self, srcrev, inclusive=False):
715 def _adjustlinkrev(self, srcrev, inclusive=False, stoprev=None):
716 """return the first ancestor of <srcrev> introducing <fnode>
716 """return the first ancestor of <srcrev> introducing <fnode>
717
717
718 If the linkrev of the file revision does not point to an ancestor of
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 :srcrev: the changeset revision we search ancestors from
722 :srcrev: the changeset revision we search ancestors from
723 :inclusive: if true, the src revision will also be checked
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 repo = self._repo
729 repo = self._repo
726 cl = repo.unfiltered().changelog
730 cl = repo.unfiltered().changelog
@@ -748,6 +752,8 b' class basefilectx(object):'
748 fnode = self._filenode
752 fnode = self._filenode
749 path = self._path
753 path = self._path
750 for a in iteranc:
754 for a in iteranc:
755 if stoprev is not None and a < stoprev:
756 return None
751 ac = cl.read(a) # get changeset data (we avoid object creation)
757 ac = cl.read(a) # get changeset data (we avoid object creation)
752 if path in ac[3]: # checking the 'files' field.
758 if path in ac[3]: # checking the 'files' field.
753 # The file has been touched, check if the content is
759 # The file has been touched, check if the content is
@@ -765,7 +771,9 b' class basefilectx(object):'
765 """
771 """
766 if self.linkrev() >= changelogrev:
772 if self.linkrev() >= changelogrev:
767 return True
773 return True
768 introrev = self._introrev()
774 introrev = self._introrev(stoprev=changelogrev)
775 if introrev is None:
776 return False
769 return introrev >= changelogrev
777 return introrev >= changelogrev
770
778
771 def introrev(self):
779 def introrev(self):
@@ -779,7 +787,15 b' class basefilectx(object):'
779 """
787 """
780 return self._introrev()
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 toprev = None
799 toprev = None
784 attrs = vars(self)
800 attrs = vars(self)
785 if r'_changeid' in attrs:
801 if r'_changeid' in attrs:
@@ -790,11 +806,12 b' class basefilectx(object):'
790 toprev = self._changectx.rev()
806 toprev = self._changectx.rev()
791
807
792 if toprev is not None:
808 if toprev is not None:
793 return self._adjustlinkrev(toprev, inclusive=True)
809 return self._adjustlinkrev(toprev, inclusive=True, stoprev=stoprev)
794 elif r'_descendantrev' in attrs:
810 elif r'_descendantrev' in attrs:
795 introrev = self._adjustlinkrev(self._descendantrev)
811 introrev = self._adjustlinkrev(self._descendantrev, stoprev=stoprev)
796 # be nice and cache the result of the computation
812 # be nice and cache the result of the computation
797 self._changeid = introrev
813 if introrev is not None:
814 self._changeid = introrev
798 return introrev
815 return introrev
799 else:
816 else:
800 return self.linkrev()
817 return self.linkrev()
General Comments 0
You need to be logged in to leave comments. Login now