equal
deleted
inserted
replaced
4 # Copyright 2007 Chris Mason <chris.mason@oracle.com> |
4 # Copyright 2007 Chris Mason <chris.mason@oracle.com> |
5 # |
5 # |
6 # This software may be used and distributed according to the terms of the |
6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2 or any later version. |
7 # GNU General Public License version 2 or any later version. |
8 |
8 |
|
9 import collections |
9 import cStringIO, email, os, errno, re, posixpath, copy |
10 import cStringIO, email, os, errno, re, posixpath, copy |
10 import tempfile, zlib, shutil |
11 import tempfile, zlib, shutil |
11 # On python2.4 you have to import these by name or they fail to |
12 # On python2.4 you have to import these by name or they fail to |
12 # load. This was not a problem on Python 2.7. |
13 # load. This was not a problem on Python 2.7. |
13 import email.Generator |
14 import email.Generator |
2100 if not node1 and not node2: |
2101 if not node1 and not node2: |
2101 node1 = repo.dirstate.p1() |
2102 node1 = repo.dirstate.p1() |
2102 |
2103 |
2103 def lrugetfilectx(): |
2104 def lrugetfilectx(): |
2104 cache = {} |
2105 cache = {} |
2105 order = util.deque() |
2106 order = collections.deque() |
2106 def getfilectx(f, ctx): |
2107 def getfilectx(f, ctx): |
2107 fctx = ctx.filectx(f, filelog=cache.get(f)) |
2108 fctx = ctx.filectx(f, filelog=cache.get(f)) |
2108 if f not in cache: |
2109 if f not in cache: |
2109 if len(cache) > 20: |
2110 if len(cache) > 20: |
2110 del cache[order.popleft()] |
2111 del cache[order.popleft()] |