diff mercurial/commands.py @ 9102:bbc78cb1bf15

Merge with stable
author Matt Mackall <mpm@selenic.com>
date Thu, 09 Jul 2009 19:49:02 -0500
parents 5d6c42f33b71 431462bd8478
children 31177742f54a
line wrap: on
line diff
--- 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