mercurial/patch.py
changeset 9123 360f61c2919f
parent 8891 5fe8dc75aa4a
child 9139 6d1f9238824e
child 9243 df21a009c9c4
equal deleted inserted replaced
9122:a9eae2f3241c 9123:360f61c2919f
  1244         opts = mdiff.defaultopts
  1244         opts = mdiff.defaultopts
  1245 
  1245 
  1246     if not node1:
  1246     if not node1:
  1247         node1 = repo.dirstate.parents()[0]
  1247         node1 = repo.dirstate.parents()[0]
  1248 
  1248 
  1249     flcache = {}
  1249     def lrugetfilectx():
  1250     def getfilectx(f, ctx):
  1250         cache = {}
  1251         flctx = ctx.filectx(f, filelog=flcache.get(f))
  1251         order = []
  1252         if f not in flcache:
  1252         def getfilectx(f, ctx):
  1253             flcache[f] = flctx._filelog
  1253             fctx = ctx.filectx(f, filelog=cache.get(f))
  1254         return flctx
  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     ctx1 = repo[node1]
  1265     ctx1 = repo[node1]
  1257     ctx2 = repo[node2]
  1266     ctx2 = repo[node2]
  1258 
  1267 
  1259     if not changes:
  1268     if not changes: