190
190
StringIO(self.get_raw_bundle()))
191
191
# We don't use the bundle's target revision, because
192
192
# MergeDirective.revision_id is authoritative.
193
info.install_revisions(target_repo, stream_input=False)
194
info.install_revisions(target_repo, stream_input=False)
195
except errors.RevisionNotPresent:
196
# At least one dependency isn't present. Try installing
197
# missing revisions from the submit branch
198
submit_branch = _mod_branch.Branch.open(self.target_branch)
199
missing_revisions = []
200
bundle_revisions = set(r.revision_id for r in
202
for revision in info.real_revisions:
203
for parent_id in revision.parent_ids:
204
if (parent_id not in bundle_revisions and
205
not target_repo.has_revision(parent_id)):
206
missing_revisions.append(parent_id)
207
# reverse missing revisions to try to get heads first
209
unique_missing_set = set()
210
for revision in reversed(missing_revisions):
211
if revision in unique_missing_set:
213
unique_missing.append(revision)
214
unique_missing_set.add(revision)
215
for missing_revision in unique_missing:
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)