Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 20863:876c17336b4e
revset: raise ValueError when calling min or max on empty smartset
min([]) raise a ValueError, we do the same thing in smartset.min() and
smartset.max() for the sake of consistency.
The min/amax test are greatly improved in the process to prevent this familly
of regression
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 28 Mar 2014 17:00:13 -0700 |
parents | bc95143446e8 |
children | 04e1596d5dbd |
comparison
equal
deleted
inserted
replaced
20862:97b2f26dfc43 | 20863:876c17336b4e |
---|---|
2285 | 2285 |
2286 def _first(self): | 2286 def _first(self): |
2287 """return the first revision in the set""" | 2287 """return the first revision in the set""" |
2288 for r in self: | 2288 for r in self: |
2289 return r | 2289 return r |
2290 return None | 2290 raise ValueError('arg is an empty sequence') |
2291 | 2291 |
2292 def _last(self): | 2292 def _last(self): |
2293 """return the last revision in the set""" | 2293 """return the last revision in the set""" |
2294 self.reverse() | 2294 self.reverse() |
2295 m = self._first() | 2295 m = self._first() |