# HG changeset patch # User Lucas Moscovicz # Date 2014-02-06 22:25:37 # Node ID 2e33cda452f6c948826dda88fe5c926a56d976a3 # Parent 4a9191ca848e232613d4577b83cc9b92bee313bb revset: added basic operations to lazyset Added methods __add__, __sub__ and __and__ to duck type more methods in baseset diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2090,5 +2090,15 @@ class lazyset(object): if cond(x): yield x + def __and__(self, x): + return lazyset(self, lambda r: r in x) + + def __sub__(self, x): + return lazyset(self, lambda r: r not in x) + + def __add__(self, x): + l = baseset([r for r in self]) + return l + baseset(x) + # tell hggettext to extract docstrings from these functions: i18nfunctions = symbols.values()