Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 22812:fcd12b310148
baseset: implement `first` and `last` methods
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 06 Oct 2014 14:42:00 -0700 |
parents | c1fd827e1ae0 |
children | 5a96df266b2b |
comparison
equal
deleted
inserted
replaced
22811:c1fd827e1ae0 | 22812:fcd12b310148 |
---|---|
2385 """Returns True if the collection is descending order, False if not. | 2385 """Returns True if the collection is descending order, False if not. |
2386 | 2386 |
2387 This is part of the mandatory API for smartset.""" | 2387 This is part of the mandatory API for smartset.""" |
2388 return False | 2388 return False |
2389 | 2389 |
2390 def first(self): | |
2391 if self: | |
2392 return self[0] | |
2393 return None | |
2394 | |
2395 def last(self): | |
2396 if self: | |
2397 return self[-1] | |
2398 return None | |
2399 | |
2390 class filteredset(abstractsmartset): | 2400 class filteredset(abstractsmartset): |
2391 """Duck type for baseset class which iterates lazily over the revisions in | 2401 """Duck type for baseset class which iterates lazily over the revisions in |
2392 the subset and contains a function which tests for membership in the | 2402 the subset and contains a function which tests for membership in the |
2393 revset | 2403 revset |
2394 """ | 2404 """ |