Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 26307:428a8747f4ee
revset: avoid implicit None testing in revset
Implicit None testing is a very good way to get in trouble. We explicitly test
for None.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 23 Sep 2015 00:41:07 -0700 |
parents | d157e1f18e3f |
children | 7d132557e44a |
comparison
equal
deleted
inserted
replaced
26306:d157e1f18e3f | 26307:428a8747f4ee |
---|---|
3223 if it is None: | 3223 if it is None: |
3224 return None | 3224 return None |
3225 return lambda: self._iterfilter(it()) | 3225 return lambda: self._iterfilter(it()) |
3226 | 3226 |
3227 def __nonzero__(self): | 3227 def __nonzero__(self): |
3228 it = self | 3228 fast = self.fastasc |
3229 fast = self.fastasc or self.fastdesc | 3229 if fast is None: |
3230 if fast: | 3230 fast = self.fastdesc |
3231 if fast is not None: | |
3231 it = fast() | 3232 it = fast() |
3233 else: | |
3234 it = self | |
3232 | 3235 |
3233 for r in it: | 3236 for r in it: |
3234 return True | 3237 return True |
3235 return False | 3238 return False |
3236 | 3239 |