comparison mercurial/context.py @ 3217: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 53e843840349
children 618a7f2c1b82
comparison
equal deleted inserted replaced
3216:5b7ed414affb 3217:dedddde58c5b
3 # Copyright 2006 Matt Mackall <mpm@selenic.com> 3 # Copyright 2006 Matt Mackall <mpm@selenic.com>
4 # 4 #
5 # This software may be used and distributed according to the terms 5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference. 6 # of the GNU General Public License, incorporated herein by reference.
7 7
8 from demandload import *
9 from node import * 8 from node import *
10 demandload(globals(), 'bdiff') 9 from i18n import gettext as _
11
12 from node import *
13 from demandload import demandload 10 from demandload import demandload
14 demandload(globals(), "ancestor util") 11 demandload(globals(), "ancestor bdiff repo util")
15 12
16 class changectx(object): 13 class changectx(object):
17 """A changecontext object makes access to data related to a particular 14 """A changecontext object makes access to data related to a particular
18 changeset convenient.""" 15 changeset convenient."""
19 def __init__(self, repo, changeid=None): 16 def __init__(self, repo, changeid=None):
81 78
82 def filectx(self, path, fileid=None): 79 def filectx(self, path, fileid=None):
83 """get a file context from this changeset""" 80 """get a file context from this changeset"""
84 if fileid is None: 81 if fileid is None:
85 fileid = self.filenode(path) 82 fileid = self.filenode(path)
83 if not fileid:
84 raise repo.LookupError(_("'%s' does not exist in changeset %s") %
85 (path, hex(self.node())))
86 return filectx(self._repo, path, fileid=fileid) 86 return filectx(self._repo, path, fileid=fileid)
87 87
88 def filectxs(self): 88 def filectxs(self):
89 """generate a file context for each file in this changeset's 89 """generate a file context for each file in this changeset's
90 manifest""" 90 manifest"""