context: None is not a valid filenode (revert from 23ede9e7ad4d)
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Mon, 27 Nov 2006 20:55:50 +0100
changeset 3712 1bd70d40ec57
parent 3711 9ccc6be9ae4d
child 3713 8ae88ed2a3b6
context: None is not a valid filenode (revert from 23ede9e7ad4d)
mercurial/context.py
--- a/mercurial/context.py	Sun Nov 26 13:28:30 2006 +0100
+++ b/mercurial/context.py	Mon Nov 27 20:55:50 2006 +0100
@@ -151,10 +151,7 @@
                 if '_fileid' in self.__dict__:
                     self._filenode = self._filelog.lookup(self._fileid)
                 else:
-                    try:
-                        self._filenode = self._changectx.filenode(self._path)
-                    except:
-                        self._filenode = self._filerev = None
+                    self._filenode = self._changectx.filenode(self._path)
             except revlog.RevlogError, inst:
                 raise repo.LookupError(str(inst))
             return self._filenode
@@ -165,7 +162,12 @@
             raise AttributeError, name
 
     def __nonzero__(self):
-        return self._filenode != None
+        try:
+            n = self._filenode
+            return True
+        except repo.LookupError:
+            # file is missing
+            return False
 
     def __str__(self):
         return "%s@%s" % (self.path(), short(self.node()))