~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: John Arbash Meinel
  • Date: 2008-09-24 12:53:22 UTC
  • mfrom: (3697.7.3 1.7)
  • mto: (3697.7.4 1.7)
  • mto: This revision was merged to the branch mainline in revision 3748.
  • Revision ID: john@arbash-meinel.com-20080924125322-p1i7pnr0m49v1hze
Bring in the 1.7 branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
449
449
                               change_reporter=self.change_reporter,
450
450
                               **kwargs)
451
451
 
 
452
    def _do_merge_to(self, merge):
 
453
        merge.do_merge()
 
454
        if self.recurse == 'down':
 
455
            for relpath, file_id in self.this_tree.iter_references():
 
456
                sub_tree = self.this_tree.get_nested_tree(file_id, relpath)
 
457
                other_revision = self.other_tree.get_reference_revision(
 
458
                    file_id, relpath)
 
459
                if  other_revision == sub_tree.last_revision():
 
460
                    continue
 
461
                sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)
 
462
                sub_merge.merge_type = self.merge_type
 
463
                other_branch = self.other_branch.reference_parent(file_id, relpath)
 
464
                sub_merge.set_other_revision(other_revision, other_branch)
 
465
                base_revision = self.base_tree.get_reference_revision(file_id)
 
466
                sub_merge.base_tree = \
 
467
                    sub_tree.branch.repository.revision_tree(base_revision)
 
468
                sub_merge.base_rev_id = base_revision
 
469
                sub_merge.do_merge()
 
470
        
452
471
    def do_merge(self):
453
472
        self.this_tree.lock_tree_write()
454
 
        if self.base_tree is not None:
455
 
            self.base_tree.lock_read()
456
 
        if self.other_tree is not None:
457
 
            self.other_tree.lock_read()
458
473
        try:
459
 
            merge = self.make_merger()
460
 
            merge.do_merge()
461
 
            if self.recurse == 'down':
462
 
                for relpath, file_id in self.this_tree.iter_references():
463
 
                    sub_tree = self.this_tree.get_nested_tree(file_id, relpath)
464
 
                    other_revision = self.other_tree.get_reference_revision(
465
 
                        file_id, relpath)
466
 
                    if  other_revision == sub_tree.last_revision():
467
 
                        continue
468
 
                    sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)
469
 
                    sub_merge.merge_type = self.merge_type
470
 
                    other_branch = self.other_branch.reference_parent(file_id, relpath)
471
 
                    sub_merge.set_other_revision(other_revision, other_branch)
472
 
                    base_revision = self.base_tree.get_reference_revision(file_id)
473
 
                    sub_merge.base_tree = \
474
 
                        sub_tree.branch.repository.revision_tree(base_revision)
475
 
                    sub_merge.base_rev_id = base_revision
476
 
                    sub_merge.do_merge()
477
 
 
478
 
        finally:
479
 
            if self.other_tree is not None:
480
 
                self.other_tree.unlock()
481
474
            if self.base_tree is not None:
482
 
                self.base_tree.unlock()
 
475
                self.base_tree.lock_read()
 
476
            try:
 
477
                if self.other_tree is not None:
 
478
                    self.other_tree.lock_read()
 
479
                try:
 
480
                    merge = self.make_merger()
 
481
                    self._do_merge_to(merge)
 
482
                finally:
 
483
                    if self.other_tree is not None:
 
484
                        self.other_tree.unlock()
 
485
            finally:
 
486
                if self.base_tree is not None:
 
487
                    self.base_tree.unlock()
 
488
        finally:
483
489
            self.this_tree.unlock()
484
490
        if len(merge.cooked_conflicts) == 0:
485
491
            if not self.ignore_zero and not is_quiet():