changeset 38595:f8b46245b26a

py3: make 'None in lazyancestors' not crash This looks somewhat weird, but we have callers like 'torev(n) in futurecommon' around where torev(n) is dictlike.get(n). I could fix callers, but that would be unnecessarily verbose.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 08 Jul 2018 17:17:54 +0900
parents b263133eeb5a
children 1fad808f2a6b
files mercurial/ancestor.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ancestor.py	Sun Jul 08 16:55:21 2018 +0900
+++ b/mercurial/ancestor.py	Sun Jul 08 17:17:54 2018 +0900
@@ -339,6 +339,10 @@
         seen = self._containsseen
         if target in seen:
             return True
+        # Only integer target is valid, but some callers expect 'None in self'
+        # to be False. So we explicitly allow it.
+        if target is None:
+            return False
 
         parentrevs = self._parentrevs
         visit = self._containsvisit