# HG changeset patch # User Lucas Moscovicz # Date 2014-03-14 16:07:59 # Node ID fa1ac5faa7c4613bc4a627aabb8b9fdf9378e00e # Parent 41e1064486f96bd2761acf85e197e627346c292e revset: added __nonzero__ method to spanset class Implemented it in a lazy way, just look for the first non-filtered revision and return True if there's any revision at all. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2490,6 +2490,11 @@ class spanset(object): return self._contained(x) and not (self._hiddenrevs and rev in self._hiddenrevs) + def __nonzero__(self): + for r in self: + return True + return False + def __and__(self, x): if isinstance(x, baseset): x = x.set()