Make changectx.filenode raise repo.LookupError on failure
authorBrendan Cully <brendan@kublai.com>
Tue, 03 Oct 2006 12:28:27 -0700
changeset 3242 1539f788e913
parent 3241 a184cd0c2db9
child 3243 1d3aceae87c1
Make changectx.filenode raise repo.LookupError on failure
mercurial/context.py
--- a/mercurial/context.py	Tue Oct 03 12:14:33 2006 -0700
+++ b/mercurial/context.py	Tue Oct 03 12:28:27 2006 -0700
@@ -73,8 +73,14 @@
 
     def filenode(self, path):
         if hasattr(self, "_manifest"):
-            return self._manifest[path]
+            try:
+                return self._manifest[path]
+            except KeyError:
+                raise repo.LookupError(_("'%s' not found in manifest") % path)
         node, flag = self._repo.manifest.find(self._changeset[0], path)
+        if not node:
+            raise repo.LookupError(_("'%s' not found in manifest") % path)
+
         return node
 
     def filectx(self, path, fileid=None):