Mercurial > hg-stable
comparison mercurial/revset.py @ 22729:f7b0ebe6ad42
abstractsmartset: add default implementation for __add__
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 02 Oct 2014 19:22:03 -0500 |
parents | bf5ff3686100 |
children | aeacc2055f0d |
comparison
equal
deleted
inserted
replaced
22728:bf5ff3686100 | 22729:f7b0ebe6ad42 |
---|---|
2278 | 2278 |
2279 def __add__(self, other): | 2279 def __add__(self, other): |
2280 """Returns a new object with the union of the two collections. | 2280 """Returns a new object with the union of the two collections. |
2281 | 2281 |
2282 This is part of the mandatory API for smartset.""" | 2282 This is part of the mandatory API for smartset.""" |
2283 raise NotImplementedError() | 2283 kwargs = {} |
2284 if self.isascending() and other.isascending(): | |
2285 kwargs['ascending'] = True | |
2286 if self.isdescending() and other.isdescending(): | |
2287 kwargs['ascending'] = False | |
2288 return _addset(self, other, **kwargs) | |
2284 | 2289 |
2285 def __sub__(self, other): | 2290 def __sub__(self, other): |
2286 """Returns a new object with the substraction of the two collections. | 2291 """Returns a new object with the substraction of the two collections. |
2287 | 2292 |
2288 This is part of the mandatory API for smartset.""" | 2293 This is part of the mandatory API for smartset.""" |