188
188
if self.patch_type == 'bundle':
189
189
info = bundle_serializer.read_bundle(
190
190
StringIO(self.get_raw_bundle()))
191
missing_revisions = []
192
for revision in info.real_revisions:
193
for parent_id in revision.parent_ids:
194
if (parent_id not in info.real_revisions and
195
not target_repo.has_revision(parent_id)):
196
missing_revisions.append(parent_id)
197
if len(missing_revisions) > 0:
198
target_branch = _mod_branch.Branch.open(self.target_branch)
199
for missing_revision in missing_revisions:
200
target_repo.fetch(target_branch.repository,
191
202
# We don't use the bundle's target revision, because
192
203
# MergeDirective.revision_id is authoritative.
193
info.install_revisions(target_repo, stream_input=False)
205
info.install_revisions(target_repo, stream_input=False)
206
except errors.RevisionNotPresent:
207
# At least one dependency isn't present. Try installing
208
# missing revisions from the submit branch
209
for revision in info.real_revisions:
210
for parent_id in revision.parent_ids:
211
if (parent_id not in info.real_revisions and
212
not target_repo.has_revision(parent_id)):
213
missing_revisions.append(parent_id)
214
submit_branch = _mod_branch.Branch.open(self.target_branch)
215
for missing_revision in missing_revisions:
216
target_repo.fetch(submit_branch.repository,
218
info.install_revisions(target_repo, stream_input=False)
195
220
source_branch = _mod_branch.Branch.open(self.source_branch)
196
221
target_repo.fetch(source_branch.repository, self.revision_id)