mercurial/commands.py
changeset 9102 bbc78cb1bf15
parent 9080 5d6c42f33b71
parent 9097 431462bd8478
child 9136 31177742f54a
--- a/mercurial/commands.py	Sat Jul 04 14:18:15 2009 +0100
+++ b/mercurial/commands.py	Thu Jul 09 19:49:02 2009 -0500
@@ -1183,18 +1183,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