223
223
def lock_read(self):
226
def revision_tree(self, revision_id):
227
"""Obtain a revision tree for the revision revision_id.
229
The intention of this method is to allow access to possibly cached
230
tree data. Implementors of this method should raise NoSuchRevision if
231
the tree is not locally available, even if they could obtain the
232
tree via a repository or some other means. Callers are responsible
233
for finding the ultimate source for a revision tree.
235
:param revision_id: The revision_id of the requested tree.
237
:raises: NoSuchRevision if the tree cannot be obtained.
239
raise errors.NoSuchRevisionInTree(self, revision_id)
226
241
def unknowns(self):
227
242
"""What files are present in this tree and unknown.
244
259
pred = self.inventory.has_filename
245
260
return set((p for p in paths if not pred(p)))
262
def walkdirs(self, prefix=""):
263
"""Walk the contents of this tree from path down.
265
This yields all the data about the contents of a directory at a time.
266
After each directory has been yielded, if the caller has mutated the
267
list to exclude some directories, they are then not descended into.
269
The data yielded is of the form:
270
((directory-relpath, directory-path-from-root, directory-fileid),
271
[(relpath, basename, kind, lstat, path_from_tree_root, file_id,
272
versioned_kind), ...]),
273
- directory-relpath is the containing dirs relpath from prefix
274
- directory-path-from-root is the containing dirs path from /
275
- directory-fileid is the id of the directory if it is versioned.
276
- relpath is the relative path within the subtree being walked.
277
- basename is the basename
278
- kind is the kind of the file now. If unknonwn then the file is not
279
present within the tree - but it may be recorded as versioned. See
281
- lstat is the stat data *if* the file was statted.
282
- path_from_tree_root is the path from the root of the tree.
283
- file_id is the file_id is the entry is versioned.
284
- versioned_kind is the kind of the file as last recorded in the
285
versioning system. If 'unknown' the file is not versioned.
286
One of 'kind' and 'versioned_kind' must not be 'unknown'.
288
:param prefix: Start walking from prefix within the tree rather than
289
at the root. This allows one to walk a subtree but get paths that are
290
relative to a tree rooted higher up.
291
:return: an iterator over the directory data.
293
raise NotImplementedError(self.walkdirs)
248
296
class EmptyTree(Tree):