~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Robert Collins
  • Date: 2007-03-06 12:28:18 UTC
  • mto: (2321.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: robertc@robertcollins.net-20070306122818-xk0lc3l01ecl6vbc
Get merge_nested finally working: change nested tree iterators to take file_ids, and ensure the right branch is connected to in the merge logic. May not be suitable for shared repositories yet.

Show diffs side-by-side

added added

removed removed

Lines of Context:
298
298
            merge = self.merge_type(pb=self._pb,
299
299
                                    change_reporter=self.change_reporter,
300
300
                                    **kwargs)
 
301
            if self.recurse == 'down':
 
302
                for path, file_id in self.this_tree.iter_references():
 
303
                    sub_tree = self.this_tree.get_nested_tree(file_id, path)
 
304
                    other_revision = self.other_tree.get_reference_revision(
 
305
                        file_id, path)
 
306
                    if  other_revision == sub_tree.last_revision():
 
307
                        continue
 
308
                    sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)
 
309
                    sub_merge.merge_type = self.merge_type
 
310
                    relpath = self.this_tree.relpath(path)
 
311
                    other_branch = self.other_branch.reference_parent(file_id, relpath)
 
312
                    sub_merge.set_other_revision(other_revision, other_branch)
 
313
                    base_revision = self.base_tree.get_reference_revision(file_id)
 
314
                    sub_merge.base_tree = \
 
315
                        sub_tree.branch.repository.revision_tree(base_revision)
 
316
                    sub_merge.do_merge()
 
317
 
301
318
        finally:
302
319
            if self.other_tree is not None:
303
320
                self.other_tree.unlock()
310
327
        else:
311
328
            note("%d conflicts encountered." % len(merge.cooked_conflicts))
312
329
 
313
 
        if self.recurse == 'down':
314
 
            for path, entry in self.this_tree.iter_reference_entries():
315
 
                sub_tree = self.this_tree.get_nested_tree(entry, path)
316
 
                other_entry = self.other_tree.inventory[entry.file_id]
317
 
                other_revision = self.other_tree.get_reference_revision(
318
 
                    other_entry, path)
319
 
                if  other_revision == sub_tree.last_revision():
320
 
                    continue
321
 
                sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)
322
 
                sub_merge.merge_type = self.merge_type
323
 
                other_branch = self.other_branch.reference_parent(
324
 
                    entry.file_id, path)
325
 
                sub_merge.set_other_revision(other_revision, other_branch)
326
 
                base_entry = self.base_tree.inventory[entry.file_id]
327
 
                base_revision = \
328
 
                    self.base_tree.get_reference_revision(base_entry)
329
 
                sub_merge.base_tree = \
330
 
                    sub_tree.branch.repository.revision_tree(base_revision)
331
 
                sub_merge.do_merge()
332
 
 
333
330
        return len(merge.cooked_conflicts)
334
331
 
335
332
    def regen_inventory(self, new_entries):