mercurial/patch.py
changeset 16803 107a3270a24a
parent 16705 c2d9ef43ff6c
child 16828 8abee656e14c
--- a/mercurial/patch.py	Tue May 15 10:44:17 2012 -0700
+++ b/mercurial/patch.py	Tue May 15 10:46:23 2012 -0700
@@ -12,7 +12,7 @@
 from i18n import _
 from node import hex, nullid, short
 import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error
-import context
+import collections, context
 
 gitre = re.compile('diff --git a/(.*) b/(.*)')
 
@@ -1588,12 +1588,12 @@
 
     def lrugetfilectx():
         cache = {}
-        order = []
+        order = collections.deque()
         def getfilectx(f, ctx):
             fctx = ctx.filectx(f, filelog=cache.get(f))
             if f not in cache:
                 if len(cache) > 20:
-                    del cache[order.pop(0)]
+                    del cache[order.popleft()]
                 cache[f] = fctx.filelog()
             else:
                 order.remove(f)