filecontext: report False for missing files
authorMatt Mackall <mpm@selenic.com>
Wed, 18 Oct 2006 14:06:48 -0500
changeset 3454 23ede9e7ad4d
parent 3453 dba3cadef789
child 3455 baa271270829
filecontext: report False for missing files
mercurial/context.py
--- a/mercurial/context.py	Wed Oct 18 11:44:56 2006 -0500
+++ b/mercurial/context.py	Wed Oct 18 14:06:48 2006 -0500
@@ -151,7 +151,10 @@
                 if '_fileid' in self.__dict__:
                     self._filenode = self._filelog.lookup(self._fileid)
                 else:
-                    self._filenode = self._changectx.filenode(self._path)
+                    try:
+                        self._filenode = self._changectx.filenode(self._path)
+                    except:
+                        self._filenode = self._filerev = None
             except revlog.RevlogError, inst:
                 raise repo.LookupError(str(inst))
             return self._filenode
@@ -162,7 +165,7 @@
             raise AttributeError, name
 
     def __nonzero__(self):
-        return self._filerev != nullid
+        return self._filenode != None
 
     def __str__(self):
         return "%s@%s" % (self.path(), short(self.node()))