mercurial/commands.py
changeset 8408 72538f1909ec
parent 8407 223000a687b0
child 8464 7af92e70bb25
--- a/mercurial/commands.py	Thu May 14 13:20:40 2009 -0500
+++ b/mercurial/commands.py	Thu May 14 13:20:40 2009 -0500
@@ -1154,9 +1154,16 @@
         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]
 
     def matchlines(body):