290 def getcommit(self, rev): |
290 def getcommit(self, rev): |
291 if rev not in self.commits: |
291 if rev not in self.commits: |
292 uuid, module, revnum = self.revsplit(rev) |
292 uuid, module, revnum = self.revsplit(rev) |
293 self.module = module |
293 self.module = module |
294 self.reparent(module) |
294 self.reparent(module) |
|
295 # We assume that: |
|
296 # - requests for revisions after "stop" come from the |
|
297 # revision graph backward traversal. Cache all of them |
|
298 # down to stop, they will be used eventually. |
|
299 # - requests for revisions before "stop" come to get |
|
300 # isolated branches parents. Just fetch what is needed. |
295 stop = self.lastrevs.get(module, 0) |
301 stop = self.lastrevs.get(module, 0) |
|
302 if revnum < stop: |
|
303 stop = revnum + 1 |
296 self._fetch_revisions(revnum, stop) |
304 self._fetch_revisions(revnum, stop) |
297 commit = self.commits[rev] |
305 commit = self.commits[rev] |
298 # caller caches the result, so free it here to release memory |
306 # caller caches the result, so free it here to release memory |
299 del self.commits[rev] |
307 del self.commits[rev] |
300 return commit |
308 return commit |