~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/intset.py

  • Committer: Erik Bågfors
  • Date: 2006-02-03 19:50:59 UTC
  • mto: (1185.50.77 bzr-jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1554.
  • Revision ID: erik@bagfors.nu-20060203195059-1cf8ff5aa68de0ea
Support for plugins to register log formatters and set default formatter
Also, change one command line option for "log"

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/python
2
 
 
3
1
# Copyright (C) 2005 Canonical Ltd
4
2
 
5
3
# This program is free software; you can redistribute it and/or modify
210
208
        if not self._val & m:
211
209
            raise KeyError(to_remove)
212
210
        self._val ^= m
213
 
        
214
 
        
215
 
            
216
 
    
217
 
 
218
 
if __name__ == '__main__':
219
 
    import doctest
220
 
    doctest.testmod()
221
 
    
 
211
 
 
212
    def set_remove(self, to_remove):
 
213
        """Remove all values that exist in to_remove.
 
214
 
 
215
        >>> a = IntSet(range(10))
 
216
        >>> b = IntSet([2,3,4,7,12])
 
217
        >>> a.set_remove(b)
 
218
        >>> list(a)
 
219
        [0, 1, 5, 6, 8, 9]
 
220
        >>> a.set_remove([1,2,5])
 
221
        >>> list(a)
 
222
        [0, 6, 8, 9]
 
223
        """
 
224
        if not isinstance(to_remove, IntSet):
 
225
            self.set_remove(IntSet(to_remove))
 
226
            return
 
227
        intersect = self._val & to_remove._val
 
228
        self._val ^= intersect
 
229