Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 22995:2587631c5f8a
revset: make __len__ part of the offical API
It is common for code to ask for the length of a revset. In fact, all but
generatorset already implement it.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 15 Oct 2014 04:26:23 -0700 |
parents | 5aae3dea8044 |
children | a43d929d1fa1 |
comparison
equal
deleted
inserted
replaced
22994:840be5ca03e1 | 22995:2587631c5f8a |
---|---|
2253 """return the last element in the set (user iteration perspective) | 2253 """return the last element in the set (user iteration perspective) |
2254 | 2254 |
2255 Return None if the set is empty""" | 2255 Return None if the set is empty""" |
2256 raise NotImplementedError() | 2256 raise NotImplementedError() |
2257 | 2257 |
2258 def __len__(self): | |
2259 """return the length of the smartsets | |
2260 | |
2261 This can be expensive on smartset that could be lazy otherwise.""" | |
2262 raise NotImplementedError() | |
2263 | |
2258 def reverse(self): | 2264 def reverse(self): |
2259 """reverse the expected iteration order""" | 2265 """reverse the expected iteration order""" |
2260 raise NotImplementedError() | 2266 raise NotImplementedError() |
2261 | 2267 |
2262 def sort(self, reverse=True): | 2268 def sort(self, reverse=True): |