comparison 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
comparison
equal deleted inserted replaced
23979:087603b50889 23980:c1ce5442453f
168 # this means we can miss a case like 'hg rm b; hg cp a b' 168 # this means we can miss a case like 'hg rm b; hg cp a b'
169 cm = {} 169 cm = {}
170 missing = set(b.manifest().iterkeys()) 170 missing = set(b.manifest().iterkeys())
171 missing.difference_update(a.manifest().iterkeys()) 171 missing.difference_update(a.manifest().iterkeys())
172 172
173 ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True)
173 for f in missing: 174 for f in missing:
174 ofctx = _tracefile(b[f], am, limit) 175 fctx = b[f]
176 fctx._ancestrycontext = ancestrycontext
177 ofctx = _tracefile(fctx, am, limit)
175 if ofctx: 178 if ofctx:
176 cm[f] = ofctx.path() 179 cm[f] = ofctx.path()
177 180
178 # combine copies from dirstate if necessary 181 # combine copies from dirstate if necessary
179 if w is not None: 182 if w is not None: