changeset 3225:dedddde58c5b

Raise LookupError in changectx.filectx if filenode can't be found
author Brendan Cully <brendan@kublai.com>
date Sun, 01 Oct 2006 12:42:50 -0700
parents 5b7ed414affb
children 5c6028778c5a
files mercurial/context.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Sun Oct 01 11:58:55 2006 -0700
+++ b/mercurial/context.py	Sun Oct 01 12:42:50 2006 -0700
@@ -5,13 +5,10 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-from demandload import *
 from node import *
-demandload(globals(), 'bdiff')
-
-from node import *
+from i18n import gettext as _
 from demandload import demandload
-demandload(globals(), "ancestor util")
+demandload(globals(), "ancestor bdiff repo util")
 
 class changectx(object):
     """A changecontext object makes access to data related to a particular
@@ -83,6 +80,9 @@
         """get a file context from this changeset"""
         if fileid is None:
             fileid = self.filenode(path)
+            if not fileid:
+                raise repo.LookupError(_("'%s' does not exist in changeset %s") %
+                                       (path, hex(self.node())))
         return filectx(self._repo, path, fileid=fileid)
 
     def filectxs(self):