comparison mercurial/context.py @ 9097:431462bd8478

fix memory usage of revlog caches by limiting cache size [issue1639]
author Matt Mackall <mpm@selenic.com>
date Thu, 09 Jul 2009 17:10:07 -0500
parents db3c1ab0e632
children 71d26ae62fbb
comparison
equal deleted inserted replaced
9096:47bc92755b95 9097:431462bd8478
377 def pair(parent, child): 377 def pair(parent, child):
378 for a1, a2, b1, b2 in bdiff.blocks(parent[1], child[1]): 378 for a1, a2, b1, b2 in bdiff.blocks(parent[1], child[1]):
379 child[0][b1:b2] = parent[0][a1:a2] 379 child[0][b1:b2] = parent[0][a1:a2]
380 return child 380 return child
381 381
382 getlog = util.cachefunc(lambda x: self._repo.file(x)) 382 getlog = util.lrucachefunc(lambda x: self._repo.file(x))
383 def getctx(path, fileid): 383 def getctx(path, fileid):
384 log = path == self._path and self._filelog or getlog(path) 384 log = path == self._path and self._filelog or getlog(path)
385 return filectx(self._repo, path, fileid=fileid, filelog=log) 385 return filectx(self._repo, path, fileid=fileid, filelog=log)
386 getctx = util.cachefunc(getctx) 386 getctx = util.lrucachefunc(getctx)
387 387
388 def parents(f): 388 def parents(f):
389 # we want to reuse filectx objects as much as possible 389 # we want to reuse filectx objects as much as possible
390 p = f._path 390 p = f._path
391 if f._filerev is None: # working dir 391 if f._filerev is None: # working dir