##// END OF EJS Templates
Make patch.diff filelog cache LRU of 20 files. Fixes issue1738....
Brendan Cully -
r9123:360f61c2 default
parent child Browse files
Show More
@@ -1246,12 +1246,21 b' def diff(repo, node1=None, node2=None, m'
1246 1246 if not node1:
1247 1247 node1 = repo.dirstate.parents()[0]
1248 1248
1249 flcache = {}
1249 def lrugetfilectx():
1250 cache = {}
1251 order = []
1250 1252 def getfilectx(f, ctx):
1251 flctx = ctx.filectx(f, filelog=flcache.get(f))
1252 if f not in flcache:
1253 flcache[f] = flctx._filelog
1254 return flctx
1253 fctx = ctx.filectx(f, filelog=cache.get(f))
1254 if f not in cache:
1255 if len(cache) > 20:
1256 del cache[order.pop(0)]
1257 cache[f] = fctx._filelog
1258 else:
1259 order.remove(f)
1260 order.append(f)
1261 return fctx
1262 return getfilectx
1263 getfilectx = lrugetfilectx()
1255 1264
1256 1265 ctx1 = repo[node1]
1257 1266 ctx2 = repo[node2]
General Comments 0
You need to be logged in to leave comments. Login now