At http://bzr.arbash-meinel.com/branches/bzr/1.11/fifo_cache

------------------------------------------------------------
revno: 3893
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: John Arbash Meinel <[EMAIL PROTECTED]>
branch nick: fifo_cache
timestamp: Tue 2008-12-09 18:07:33 -0600
message:
  Handle that Python2.4 doesn't have collections.deque.remove
=== modified file 'bzrlib/fifo_cache.py'
--- a/bzrlib/fifo_cache.py      2008-12-09 22:26:40 +0000
+++ b/bzrlib/fifo_cache.py      2008-12-10 00:07:33 +0000
@@ -39,7 +39,16 @@
 
     def __delitem__(self, key):
         # Remove the key from an arbitrary location in the queue
-        self._queue.remove(key)
+        remove = getattr(self._queue, 'remove', None)
+        # Python2.5's has deque.remove, but Python2.4 does not
+        if remove is not None:
+            remove(key)
+        else:
+            # TODO: It would probably be faster to pop()/popleft() until we 
get to the
+            #       key, and then insert those back into the queue. We know
+            #       the key should only be present in one position, and we
+            #       wouldn't need to rebuild the whole queue.
+            self._queue = deque([k for k in self._queue if k != key])
         self._remove(key)
 
     def add(self, key, value, cleanup=None):

-- 
bazaar-commits mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/bazaar-commits

Reply via email to