134
137
timestamp, timezone, committer, revprops, revision_id,
140
def iter_files_bytes(self, desired_files):
141
"""Iterate through file versions.
143
Files will not necessarily be returned in the order they occur in
144
desired_files. No specific order is guaranteed.
146
Yields pairs of identifier, bytes_iterator. identifier is an opaque
147
value supplied by the caller as part of desired_files. It should
148
uniquely identify the file version in the caller's context. (Examples:
149
an index number or a TreeTransform trans_id.)
151
bytes_iterator is an iterable of bytestrings for the file. The
152
kind of iterable and length of the bytestrings are unspecified, but for
153
this implementation, it is a list of bytes produced by
154
VersionedFile.get_record_stream().
156
:param desired_files: a list of (file_id, revision_id, identifier)
160
for (file_id, revision_id, identifier) in desired_files:
161
per_revision.setdefault(revision_id, []).append((file_id, identifier))
162
for revid, files in per_revision.iteritems():
163
(commit_id, mapping) = self.lookup_bzr_revision_id(revid)
165
commit = self._git.object_store[commit_id]
167
raise errors.RevisionNotPresent(revid, self)
168
root_tree = commit.tree
169
for fileid, identifier in files:
170
path = mapping.parse_file_id(fileid)
172
obj = tree_lookup_path(
173
self._git.object_store.__getitem__, root_tree, path)
174
if isinstance(obj, tuple):
175
(mode, item_id) = obj
176
obj = self._git.object_store[item_id]
178
raise errors.RevisionNotPresent((fileid, revid), self)
180
if obj.type_name == "tree":
181
yield (identifier, [])
182
elif obj.type_name == "blob":
183
yield (identifier, obj.chunked)
185
raise AssertionError("file text resolved to %r" % obj)
137
188
def _iter_revision_ids(self):
138
189
mapping = self.get_mapping()
139
190
for sha in self._git.object_store: