Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 22727:0f3e240a1c35
abstractsmartset: add default implementation for filter
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 01 Oct 2014 00:26:50 -0500 |
parents | 169aa5e74b52 |
children | bf5ff3686100 |
comparison
equal
deleted
inserted
replaced
22726:169aa5e74b52 | 22727:0f3e240a1c35 |
---|---|
2293 | 2293 |
2294 `condition` is a callable which takes a revision number and returns a | 2294 `condition` is a callable which takes a revision number and returns a |
2295 boolean. | 2295 boolean. |
2296 | 2296 |
2297 This is part of the mandatory API for smartset.""" | 2297 This is part of the mandatory API for smartset.""" |
2298 raise NotImplementedError() | 2298 kwargs = {} |
2299 if self.isascending(): | |
2300 kwargs['ascending'] = True | |
2301 elif self.isdescending(): | |
2302 kwargs['ascending'] = False | |
2303 return filteredset(self, condition, **kwargs) | |
2299 | 2304 |
2300 class baseset(list, abstractsmartset): | 2305 class baseset(list, abstractsmartset): |
2301 """Basic data structure that represents a revset and contains the basic | 2306 """Basic data structure that represents a revset and contains the basic |
2302 operation that it should be able to perform. | 2307 operation that it should be able to perform. |
2303 | 2308 |