mercurial/commands.py
changeset 9097 431462bd8478
parent 8995 7b19cda0fa10
child 9102 bbc78cb1bf15
child 9128 98d90ad54749
--- a/mercurial/commands.py	Thu Jul 09 11:59:12 2009 +0200
+++ b/mercurial/commands.py	Thu Jul 09 17:10:07 2009 -0500
@@ -1206,18 +1206,7 @@
     if opts.get('print0'):
         sep = eol = '\0'
 
-    fcache = {}
-    forder = []
-    def getfile(fn):
-        if fn not in fcache:
-            if len(fcache) > 20:
-                del fcache[forder.pop(0)]
-            fcache[fn] = repo.file(fn)
-        else:
-            forder.remove(fn)
-
-        forder.append(fn)
-        return fcache[fn]
+    getfile = util.lrucachefunc(repo.file)
 
     def matchlines(body):
         begin = 0