diff --git a/mercurial/context.py b/mercurial/context.py index 087603b508897684b1ef929e7b4c395500101353_bWVyY3VyaWFsL2NvbnRleHQucHk=..c1ce5442453ff6fe63e7da0f8804db1845ecaf98_bWVyY3VyaWFsL2NvbnRleHQucHk= 100644 --- a/mercurial/context.py +++ b/mercurial/context.py @@ -766,4 +766,10 @@ # fetch the linkrev fr = filelog.rev(fnode) lkr = filelog.linkrev(fr) + # hack to reuse ancestor computation when searching for renames + memberanc = getattr(self, '_ancestrycontext', None) + iteranc = None + if memberanc is None: + memberanc = iteranc = cl.ancestors([srcrev], lkr, + inclusive=inclusive) # check if this linkrev is an ancestor of srcrev @@ -769,7 +775,8 @@ # check if this linkrev is an ancestor of srcrev - anc = cl.ancestors([srcrev], lkr, inclusive=inclusive) - if lkr not in anc: - for a in anc: + if lkr not in memberanc: + if iteranc is None: + iteranc = cl.ancestors([srcrev], lkr, inclusive=inclusive) + for a in iteranc: ac = cl.read(a) # get changeset data (we avoid object creation) if path in ac[3]: # checking the 'files' field. # The file has been touched, check if the content is @@ -826,6 +833,8 @@ rev = self._adjustlinkrev(path, l, fnode, self.rev()) fctx = filectx(self._repo, path, fileid=fnode, filelog=l, changeid=rev) + fctx._ancestrycontext = getattr(self, '_ancestrycontext', None) + else: fctx = filectx(self._repo, path, fileid=fnode, filelog=l) ret.append(fctx) diff --git a/mercurial/copies.py b/mercurial/copies.py index 087603b508897684b1ef929e7b4c395500101353_bWVyY3VyaWFsL2NvcGllcy5weQ==..c1ce5442453ff6fe63e7da0f8804db1845ecaf98_bWVyY3VyaWFsL2NvcGllcy5weQ== 100644 --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -170,4 +170,5 @@ missing = set(b.manifest().iterkeys()) missing.difference_update(a.manifest().iterkeys()) + ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True) for f in missing: @@ -173,5 +174,7 @@ 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()