Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 22713:f5f51872883d
abstractsmartset: default implementation for `ascending` and `descending`
These two methods are actually silly aliases for `sort()` and
`sort(reverse=True)`. So we get that aliasing at the abstractsmartset level. We
will slowly phase out all the custom implementations and eventually remove any
mentions of it from the code.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 02 Oct 2014 18:34:18 -0500 |
parents | 093df3b77f27 |
children | a729b91c58df |
comparison
equal
deleted
inserted
replaced
22712:093df3b77f27 | 22713:f5f51872883d |
---|---|
2224 | 2224 |
2225 def ascending(self): | 2225 def ascending(self): |
2226 """Sorts the set in ascending order (in place). | 2226 """Sorts the set in ascending order (in place). |
2227 | 2227 |
2228 This is part of the mandatory API for smartset.""" | 2228 This is part of the mandatory API for smartset.""" |
2229 raise NotImplementedError() | 2229 self.sort() |
2230 | 2230 |
2231 def isdescending(self): | 2231 def isdescending(self): |
2232 """True if the set will iterate in descending order""" | 2232 """True if the set will iterate in descending order""" |
2233 raise NotImplementedError() | 2233 raise NotImplementedError() |
2234 | 2234 |
2235 def descending(self): | 2235 def descending(self): |
2236 """Sorts the set in descending order (in place). | 2236 """Sorts the set in descending order (in place). |
2237 | 2237 |
2238 This is part of the mandatory API for smartset.""" | 2238 This is part of the mandatory API for smartset.""" |
2239 raise NotImplementedError() | 2239 self.sort(reverse=True) |
2240 | 2240 |
2241 def min(self): | 2241 def min(self): |
2242 """return the minimum element in the set""" | 2242 """return the minimum element in the set""" |
2243 raise NotImplementedError() | 2243 raise NotImplementedError() |
2244 | 2244 |