# HG changeset patch # User Brendan Cully # Date 1159735448 25200 # Node ID 618a7f2c1b8216469c83f9bb853e46b4b3779d14 # Parent 5c6028778c5a6f8222573c031427dc5a40e21b25 Make filectx.__init__ use LookupError diff -r 5c6028778c5a -r 618a7f2c1b82 mercurial/context.py --- a/mercurial/context.py Sun Oct 01 12:56:58 2006 -0700 +++ b/mercurial/context.py Sun Oct 01 13:44:08 2006 -0700 @@ -8,7 +8,7 @@ from node import * from i18n import gettext as _ from demandload import demandload -demandload(globals(), "ancestor bdiff repo util") +demandload(globals(), "ancestor bdiff repo revlog util") class changectx(object): """A changecontext object makes access to data related to a particular @@ -104,10 +104,10 @@ class filectx(object): """A filecontext object makes access to data related to a particular filerevision convenient.""" - def __init__(self, repo, path, changeid=None, fileid=None, filelog=None): + def __init__(self, repo_, path, changeid=None, fileid=None, filelog=None): """changeid can be a changeset revision, node, or tag. fileid can be a file revision or node.""" - self._repo = repo + self._repo = repo_ self._path = path assert changeid is not None or fileid is not None @@ -120,7 +120,10 @@ if fileid is None: self._changeid = changeid else: - self._filenode = self._filelog.lookup(fileid) + try: + self._filenode = self._filelog.lookup(fileid) + except revlog.RevlogError, inst: + raise repo.LookupError(str(inst)) self._changeid = self._filelog.linkrev(self._filenode) def __getattr__(self, name):