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 node import nullid, nullrev, short, hex |
8 from node import nullid, nullrev, short, hex |
9 from i18n import _ |
9 from i18n import _ |
10 import ancestor, bdiff, revlog, util, os, errno |
10 import ancestor, bdiff, error, util, os, errno |
11 |
11 |
12 class propertycache(object): |
12 class propertycache(object): |
13 def __init__(self, func): |
13 def __init__(self, func): |
14 self.func = func |
14 self.func = func |
15 self.name = func.__name__ |
15 self.name = func.__name__ |
123 def _fileinfo(self, path): |
123 def _fileinfo(self, path): |
124 if '_manifest' in self.__dict__: |
124 if '_manifest' in self.__dict__: |
125 try: |
125 try: |
126 return self._manifest[path], self._manifest.flags(path) |
126 return self._manifest[path], self._manifest.flags(path) |
127 except KeyError: |
127 except KeyError: |
128 raise revlog.LookupError(self._node, path, |
128 raise error.LookupError(self._node, path, |
129 _('not found in manifest')) |
129 _('not found in manifest')) |
130 if '_manifestdelta' in self.__dict__ or path in self.files(): |
130 if '_manifestdelta' in self.__dict__ or path in self.files(): |
131 if path in self._manifestdelta: |
131 if path in self._manifestdelta: |
132 return self._manifestdelta[path], self._manifestdelta.flags(path) |
132 return self._manifestdelta[path], self._manifestdelta.flags(path) |
133 node, flag = self._repo.manifest.find(self._changeset[0], path) |
133 node, flag = self._repo.manifest.find(self._changeset[0], path) |
134 if not node: |
134 if not node: |
135 raise revlog.LookupError(self._node, path, |
135 raise error.LookupError(self._node, path, |
136 _('not found in manifest')) |
136 _('not found in manifest')) |
137 |
137 |
138 return node, flag |
138 return node, flag |
139 |
139 |
140 def filenode(self, path): |
140 def filenode(self, path): |
141 return self._fileinfo(path)[0] |
141 return self._fileinfo(path)[0] |
142 |
142 |
143 def flags(self, path): |
143 def flags(self, path): |
144 try: |
144 try: |
145 return self._fileinfo(path)[1] |
145 return self._fileinfo(path)[1] |
146 except revlog.LookupError: |
146 except error.LookupError: |
147 return '' |
147 return '' |
148 |
148 |
149 def filectx(self, path, fileid=None, filelog=None): |
149 def filectx(self, path, fileid=None, filelog=None): |
150 """get a file context from this changeset""" |
150 """get a file context from this changeset""" |
151 if fileid is None: |
151 if fileid is None: |