comparison mercurial/revset.py @ 22730:aeacc2055f0d

abstractsmartset: add default implementation for __sub__
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 02 Oct 2014 19:22:17 -0500
parents f7b0ebe6ad42
children 22c669f3a7f9
comparison
equal deleted inserted replaced
22729:f7b0ebe6ad42 22730:aeacc2055f0d
2289 2289
2290 def __sub__(self, other): 2290 def __sub__(self, other):
2291 """Returns a new object with the substraction of the two collections. 2291 """Returns a new object with the substraction of the two collections.
2292 2292
2293 This is part of the mandatory API for smartset.""" 2293 This is part of the mandatory API for smartset."""
2294 raise NotImplementedError() 2294 c = other.__contains__
2295 return self.filter(lambda r: not c(r))
2295 2296
2296 def filter(self, condition): 2297 def filter(self, condition):
2297 """Returns this smartset filtered by condition as a new smartset. 2298 """Returns this smartset filtered by condition as a new smartset.
2298 2299
2299 `condition` is a callable which takes a revision number and returns a 2300 `condition` is a callable which takes a revision number and returns a