changeset 3712:1bd70d40ec57

context: None is not a valid filenode (revert from 23ede9e7ad4d)
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Mon, 27 Nov 2006 20:55:50 +0100
parents 9ccc6be9ae4d
children 8ae88ed2a3b6
files mercurial/context.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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()))