~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Aaron Bentley
  • Date: 2007-12-10 15:20:39 UTC
  • mto: (1551.19.24 Aaron's mergeable stuff)
  • mto: This revision was merged to the branch mainline in revision 3109.
  • Revision ID: abentley@panoramicfeedback.com-20071210152039-ukhnolt0imqcrmyd
Merge directives can now fetch prerequisites from the target branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
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,
 
201
                                          missing_revision)
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)
 
204
                try:
 
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,
 
217
                                          missing_revision)
 
218
                    info.install_revisions(target_repo, stream_input=False)
194
219
            else:
195
220
                source_branch = _mod_branch.Branch.open(self.source_branch)
196
221
                target_repo.fetch(source_branch.repository, self.revision_id)