Mercurial > hg-stable
diff mercurial/copies.py @ 23980:c1ce5442453f stable
_adjustlinkrev: reuse ancestors set during rename detection (issue4514)
The new linkrev adjustement mechanism makes rename detection very slow, because
each file rewalks the ancestor dag. To mitigate the issue in Mercurial 3.3, we
introduce a simplistic way to share the ancestors computation for the linkrev
validation phase.
We can reuse the ancestors in that case because we do not care about
sub-branching in the ancestors graph.
The cached set will be use to check if the linkrev is valid in the search
context. This is the vast majority of the ancestors usage during copies search
since the uncached one will only be used when linkrev is invalid, which is
hopefully rare.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 30 Jan 2015 16:02:28 +0000 |
parents | e53f6b72a0e4 |
children | 751d1138ce35 |
line wrap: on
line diff
--- a/mercurial/copies.py Fri Jan 30 14:39:03 2015 +0000 +++ b/mercurial/copies.py Fri Jan 30 16:02:28 2015 +0000 @@ -170,8 +170,11 @@ missing = set(b.manifest().iterkeys()) missing.difference_update(a.manifest().iterkeys()) + ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True) for f in missing: - ofctx = _tracefile(b[f], am, limit) + fctx = b[f] + fctx._ancestrycontext = ancestrycontext + ofctx = _tracefile(fctx, am, limit) if ofctx: cm[f] = ofctx.path()