/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/fifo_cache.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
    def __delitem__(self, key):
43
43
        # Remove the key from an arbitrary location in the queue
44
 
        remove = getattr(self._queue, 'remove', None)
45
 
        # Python2.5's has deque.remove, but Python2.4 does not
46
 
        if remove is not None:
47
 
            remove(key)
48
 
        else:
49
 
            # TODO: It would probably be faster to pop()/popleft() until we get to the
50
 
            #       key, and then insert those back into the queue. We know
51
 
            #       the key should only be present in one position, and we
52
 
            #       wouldn't need to rebuild the whole queue.
53
 
            self._queue = deque([k for k in self._queue if k != key])
 
44
        self._queue.remove(key)
54
45
        self._remove(key)
55
46
 
56
47
    def add(self, key, value, cleanup=None):