[PATCH 2 of 4] revset: added basic operations to lazyset
Lucas Moscovicz
lmoscovicz at fb.com
Mon Feb 10 18:49:50 CST 2014
# HG changeset patch
# User Lucas Moscovicz <lmoscovicz at fb.com>
# Date 1391725537 28800
# Thu Feb 06 14:25:37 2014 -0800
# Node ID 969baade3f73a6c26172f0c4337d92abd70fd106
# Parent dd21fb069db6f9d8fffcb50c98f0d3f29db110ba
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
@@ -2089,5 +2089,15 @@
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()
More information about the Mercurial-devel
mailing list