Mercurial > hg-stable
comparison mercurial/revset.py @ 20726:6eb9c4a9a12b
revset: use more explicit argument names for baseset methods
Use other instead of x and condition instead of l
author | Lucas Moscovicz <lmoscovicz@fb.com> |
---|---|
date | Fri, 14 Mar 2014 10:10:18 -0700 |
parents | cf628b50afbb |
children | 1e59f760d850 |
comparison
equal
deleted
inserted
replaced
20725:cf628b50afbb | 20726:6eb9c4a9a12b |
---|---|
2185 def set(self): | 2185 def set(self): |
2186 if not self._set: | 2186 if not self._set: |
2187 self._set = set(self) | 2187 self._set = set(self) |
2188 return self._set | 2188 return self._set |
2189 | 2189 |
2190 def __sub__(self, x): | 2190 def __sub__(self, other): |
2191 if isinstance(x, baseset): | 2191 if isinstance(other, baseset): |
2192 s = x.set() | 2192 s = other.set() |
2193 else: | 2193 else: |
2194 s = set(x) | 2194 s = set(other) |
2195 return baseset(self.set() - s) | 2195 return baseset(self.set() - s) |
2196 | 2196 |
2197 def __and__(self, x): | 2197 def __and__(self, other): |
2198 if isinstance(x, baseset): | 2198 |
2199 x = x.set() | 2199 if isinstance(other, baseset): |
2200 return baseset([y for y in self if y in x]) | 2200 other = other.set() |
2201 | 2201 return baseset([y for y in self if y in other]) |
2202 def __add__(self, x): | 2202 def __add__(self, other): |
2203 s = self.set() | 2203 s = self.set() |
2204 l = [r for r in x if r not in s] | 2204 l = [r for r in other if r not in s] |
2205 return baseset(list(self) + l) | 2205 return baseset(list(self) + l) |
2206 | 2206 |
2207 def isascending(self): | 2207 def isascending(self): |
2208 return False | 2208 return False |
2209 | 2209 |
2210 def isdescending(self): | 2210 def isdescending(self): |
2211 return False | 2211 return False |
2212 | 2212 |
2213 def filter(self, l): | 2213 def filter(self, condition): |
2214 return lazyset(self, l) | 2214 return lazyset(self, condition) |
2215 | 2215 |
2216 class lazyset(object): | 2216 class lazyset(object): |
2217 """Duck type for baseset class which iterates lazily over the revisions in | 2217 """Duck type for baseset class which iterates lazily over the revisions in |
2218 the subset and contains a function which tests for membership in the | 2218 the subset and contains a function which tests for membership in the |
2219 revset | 2219 revset |