201
201
"""Helper function for add - sets the entries of kinds."""
202
202
raise NotImplementedError(self._gather_kinds)
204
def get_file_with_stat(self, file_id, path=None):
205
"""Get a file handle and stat object for file_id.
207
The default implementation returns (self.get_file, None) for backwards
210
:param file_id: The file id to read.
211
:param path: The path of the file, if it is known.
212
:return: A tuple (file_handle, stat_value_or_None). If the tree has
213
no stat facility, or need for a stat cache feedback during commit,
214
it may return None for the second element of the tuple.
216
return (self.get_file(file_id, path), None)
205
219
def last_revision(self):
206
220
"""Return the revision id of the last commit performed in this tree.
248
262
raise NotImplementedError(self.mkdir)
250
def _observed_sha1(self, file_id, path, sha1):
264
def _observed_sha1(self, file_id, path, (sha1, stat_value)):
251
265
"""Tell the tree we have observed a paths sha1.
253
267
The intent of this function is to allow trees that have a hashcache to
254
update the hashcache during commit. If the observed file is too new to
255
be safely hash-cached the tree will ignore it; this will likewise mean
256
that a file changed subsequent to the file's being read and sha'd will
257
not lead to a false cache entry. A file move could cause this, and
258
in future work it would be better to pass the cache fingerprint around
259
so that its never separated from the sha, and we can supply the
260
fingerprint back to the tree during this code path.
268
update the hashcache during commit. If the observed file is too new
269
(based on the stat_value) to be safely hash-cached the tree will ignore
262
272
The default implementation does nothing.
264
274
:param file_id: The file id
265
275
:param path: The file path
266
276
:param sha1: The sha 1 that was observed.
277
:param stat_value: A stat result for the file the sha1 was read from.