Mercurial > hg-stable
comparison mercurial/revset.py @ 20483:ed57358398af
revset: added basic operations to spanset
Added methods __add__, __sub__ and __and__ to duck type more methods in
baseset
author | Lucas Moscovicz <lmoscovicz@fb.com> |
---|---|
date | Wed, 12 Feb 2014 10:22:43 -0800 |
parents | a979078bd788 |
children | 0f1ef9e9e904 |
comparison
equal
deleted
inserted
replaced
20482:a979078bd788 | 20483:ed57358398af |
---|---|
2147 | 2147 |
2148 def __contains__(self, x): | 2148 def __contains__(self, x): |
2149 return (x <= self._start and x > self._end) or (x >= self._start and x< | 2149 return (x <= self._start and x > self._end) or (x >= self._start and x< |
2150 self._end) | 2150 self._end) |
2151 | 2151 |
2152 def __and__(self, x): | |
2153 return lazyset(self, lambda r: r in x) | |
2154 | |
2155 def __sub__(self, x): | |
2156 return lazyset(self, lambda r: r not in x) | |
2157 | |
2158 def __add__(self, x): | |
2159 l = baseset(self) | |
2160 return l + baseset(x) | |
2161 | |
2152 # tell hggettext to extract docstrings from these functions: | 2162 # tell hggettext to extract docstrings from these functions: |
2153 i18nfunctions = symbols.values() | 2163 i18nfunctions = symbols.values() |