##// END OF EJS Templates
grep: make cache LRU rather than unlimited...
Matt Mackall -
r8408:72538f19 default
parent child Browse files
Show More
@@ -1154,9 +1154,16 b' def grep(ui, repo, pattern, *pats, **opt'
1154 sep = eol = '\0'
1154 sep = eol = '\0'
1155
1155
1156 fcache = {}
1156 fcache = {}
1157 forder = []
1157 def getfile(fn):
1158 def getfile(fn):
1158 if fn not in fcache:
1159 if fn not in fcache:
1160 if len(fcache) > 20:
1161 del fcache[forder.pop(0)]
1159 fcache[fn] = repo.file(fn)
1162 fcache[fn] = repo.file(fn)
1163 else:
1164 forder.remove(fn)
1165
1166 forder.append(fn)
1160 return fcache[fn]
1167 return fcache[fn]
1161
1168
1162 def matchlines(body):
1169 def matchlines(body):
General Comments 0
You need to be logged in to leave comments. Login now