# HG changeset patch # User Lucas Moscovicz # Date 2014-03-14 17:22:51 # Node ID 88aae5382519840620f5a2220589a1956b7cae65 # Parent 180d47e1fb68138adac2e6b523897da25bdc2af7 revset: added __sub__ mehtod to _addset This method is intended to duck-type baseset, so we will still have _addset as a private class but now will be able to return it without wrapping it into an orderedlazyset or a lazyset. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2419,6 +2419,12 @@ class _addset(object): return orderedlazyset(self, filterfunc, ascending=self._ascending) return lazyset(self, filterfunc) + def __sub__(self, other): + filterfunc = lambda r: r not in other + if self._ascending is not None: + return orderedlazyset(self, filterfunc, ascending=self._ascending) + return lazyset(self, filterfunc) + def _iterator(self): """Iterate over both collections without repeating elements