/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/merge_directive.py

  • Committer: Aaron Bentley
  • Date: 2007-12-14 04:44:58 UTC
  • mto: This revision was merged to the branch mainline in revision 3109.
  • Revision ID: aaron.bentley@utoronto.ca-20071214044458-ce124oijzzqwj7a6
Tags: plan-merge-ab
Updates from review

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