225
226
def get_file_by_path(self, path):
226
227
return self.get_file(self._inventory.path2id(path))
229
def iter_files_bytes(self, desired_files):
230
"""Iterate through file contents.
232
Files will not necessarily be returned in the order they occur in
233
desired_files. No specific order is guaranteed.
235
Yields pairs of identifier, bytes_iterator. identifier is an opaque
236
value supplied by the caller as part of desired_files. It should
237
uniquely identify the file version in the caller's context. (Examples:
238
an index number or a TreeTransform trans_id.)
240
bytes_iterator is an iterable of bytestrings for the file. The
241
kind of iterable and length of the bytestrings are unspecified, but for
242
this implementation, it is a tuple containing a single bytestring with
243
the complete text of the file.
245
:param desired_files: a list of (file_id, identifier) pairs
247
for file_id, identifier in desired_files:
248
# We wrap the string in a tuple so that we can return an iterable
249
# of bytestrings. (Technically, a bytestring is also an iterable
250
# of bytestrings, but iterating through each character is not
252
cur_file = (self.get_file_text(file_id),)
253
yield identifier, cur_file
228
255
def get_symlink_target(self, file_id):
229
256
"""Get the target for a given file_id.