comparison mercurial/context.py @ 24407:dd01834a696f stable

annotate: reuse ancestry context when adjusting linkrev (issue4532) The linkrev adjustment will likely do the same ancestry walking multiple time so we already have an optional mechanism to take advantage of this. Since 2896f53509a7, linkrev adjustment was done lazily to prevent too bad performance impact on rename computation. However, this laziness created a quadratic situation in 'annotate'. Mercurial repo: hg annotate mercurial/commands.py before: 8.090 after: 36.300 Mozilla repo: hg annotate layout/generic/nsTextFrame.cpp before: 1.190 after: 290.230 So we setup sharing of the ancestry context in the annotate case too. Linkrev adjustment still have an impact but it a much more sensible one. Mercurial repo: hg annotate mercurial/commands.py before: 36.300 after: 10.230 Mozilla repo: hg annotate layout/generic/nsTextFrame.cpp before: 290.230 after: 5.560
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 19 Mar 2015 19:52:23 -0700
parents 2896f53509a7
children 86de531e07e1
comparison
equal deleted inserted replaced
24304:6136704b975d 24407:dd01834a696f
911 # use linkrev to find the first changeset where self appeared 911 # use linkrev to find the first changeset where self appeared
912 base = self 912 base = self
913 introrev = self.introrev() 913 introrev = self.introrev()
914 if self.rev() != introrev: 914 if self.rev() != introrev:
915 base = self.filectx(self.filenode(), changeid=introrev) 915 base = self.filectx(self.filenode(), changeid=introrev)
916 ac = self._repo.changelog.ancestors([introrev], inclusive=True)
917 base._ancestrycontext = ac
916 918
917 # This algorithm would prefer to be recursive, but Python is a 919 # This algorithm would prefer to be recursive, but Python is a
918 # bit recursion-hostile. Instead we do an iterative 920 # bit recursion-hostile. Instead we do an iterative
919 # depth-first search. 921 # depth-first search.
920 922