comparison mercurial/context.py @ 40733:8a0136f69027

context: introduce an `isintroducedafter` method and use it in copies Right now, copy tracing make effort to not traverse the graph too much to save performance. It uses a "limit" acting as a floor revision past which data are no longer relevant to the current copy tracing. However, to enforce this limit, it does a call to `filectx.rev()` and that call can trigger a graph traversal on its own. That extra graph traversal is unaware of the current limit and can become very expensive. That cost is increased by the nature of work done in adjust link rev, we are not only walking down the graph, we are also checking the affected file for each revision we walk through. Something significantly more expensive than the walk itself. To work around this we need to make the `filectx` operation aware of the current limit. The first step is to introduce a dedicated method: `isintroducedafter`. We'll then rework that method logic to stop traversal as soon as possible.
author Boris Feld <boris.feld@octobus.net>
date Wed, 10 Oct 2018 00:50:35 +0200
parents aee94f0a36cd
children 9fa0d6dd1617
comparison
equal deleted inserted replaced
40732:aee94f0a36cd 40733:8a0136f69027
758 # But if manifest uses a buggy file revision (not children of the 758 # But if manifest uses a buggy file revision (not children of the
759 # one it replaces) we could. Such a buggy situation will likely 759 # one it replaces) we could. Such a buggy situation will likely
760 # result is crash somewhere else at to some point. 760 # result is crash somewhere else at to some point.
761 return lkr 761 return lkr
762 762
763 def isintroducedafter(self, changelogrev):
764 """True if a filectx has been introduced after a given floor revision
765 """
766 return (self.linkrev() >= changelogrev
767 or self.introrev() >= changelogrev)
768
763 def introrev(self): 769 def introrev(self):
764 """return the rev of the changeset which introduced this file revision 770 """return the rev of the changeset which introduced this file revision
765 771
766 This method is different from linkrev because it take into account the 772 This method is different from linkrev because it take into account the
767 changeset the filectx was created from. It ensures the returned 773 changeset the filectx was created from. It ensures the returned