##// END OF EJS Templates
sidedatacopies: only fetch information once for merge...
marmoute -
r43595:90213d02 default
parent child Browse files
Show More
@@ -193,13 +193,44 b' def _revinfogetter(repo):'
193 changelogrevision = cl.changelogrevision
193 changelogrevision = cl.changelogrevision
194 flags = cl.flags
194 flags = cl.flags
195
195
196 # A small cache to avoid doing the work twice for merges
197 #
198 # In the vast majority of cases, if we ask information for a revision
199 # about 1 parent, we'll later ask it for the other. So it make sense to
200 # keep the information around when reaching the first parent of a merge
201 # and dropping it after it was provided for the second parents.
202 #
203 # It exists cases were only one parent of the merge will be walked. It
204 # happens when the "destination" the copy tracing is descendant from a
205 # new root, not common with the "source". In that case, we will only walk
206 # through merge parents that are descendant of changesets common
207 # between "source" and "destination".
208 #
209 # With the current case implementation if such changesets have a copy
210 # information, we'll keep them in memory until the end of
211 # _changesetforwardcopies. We don't expect the case to be frequent
212 # enough to matters.
213 #
214 # In addition, it would be possible to reach pathological case, were
215 # many first parent are met before any second parent is reached. In
216 # that case the cache could grow. If this even become an issue one can
217 # safely introduce a maximum cache size. This would trade extra CPU/IO
218 # time to save memory.
219 merge_caches = {}
220
196 def revinfo(rev):
221 def revinfo(rev):
197 p1, p2 = parents(rev)
222 p1, p2 = parents(rev)
198 if flags(rev) & REVIDX_SIDEDATA:
223 if flags(rev) & REVIDX_SIDEDATA:
224 e = merge_caches.pop(rev, None)
225 if e is not None:
226 return e
199 c = changelogrevision(rev)
227 c = changelogrevision(rev)
200 p1copies = c.p1copies
228 p1copies = c.p1copies
201 p2copies = c.p2copies
229 p2copies = c.p2copies
202 removed = c.filesremoved
230 removed = c.filesremoved
231 if p1 != node.nullrev and p2 != node.nullrev:
232 # XXX some case we over cache, IGNORE
233 merge_caches[rev] = (p1, p2, p1copies, p2copies, removed)
203 else:
234 else:
204 p1copies = {}
235 p1copies = {}
205 p2copies = {}
236 p2copies = {}
General Comments 0
You need to be logged in to leave comments. Login now