changeset 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 f2788794183a
files mercurial/revset.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Sun Sep 20 16:53:42 2015 -0700
+++ b/mercurial/revset.py	Wed Sep 23 00:41:07 2015 -0700
@@ -3225,10 +3225,13 @@
         return lambda: self._iterfilter(it())
 
     def __nonzero__(self):
-        it = self
-        fast = self.fastasc or self.fastdesc
-        if fast:
+        fast = self.fastasc
+        if fast is None:
+            fast = self.fastdesc
+        if fast is not None:
             it = fast()
+        else:
+            it = self
 
         for r in it:
             return True