~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-09-05 05:55:02 UTC
  • mfrom: (3691.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080905055502-uq3g4uwzl6agbyy4
(mbp) Windows test fixes from markh

Show diffs side-by-side

added added

removed removed

Lines of Context:
413
413
                               change_reporter=self.change_reporter,
414
414
                               **kwargs)
415
415
 
 
416
    def _do_merge_to(self, merge):
 
417
        merge.do_merge()
 
418
        if self.recurse == 'down':
 
419
            for relpath, file_id in self.this_tree.iter_references():
 
420
                sub_tree = self.this_tree.get_nested_tree(file_id, relpath)
 
421
                other_revision = self.other_tree.get_reference_revision(
 
422
                    file_id, relpath)
 
423
                if  other_revision == sub_tree.last_revision():
 
424
                    continue
 
425
                sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)
 
426
                sub_merge.merge_type = self.merge_type
 
427
                other_branch = self.other_branch.reference_parent(file_id, relpath)
 
428
                sub_merge.set_other_revision(other_revision, other_branch)
 
429
                base_revision = self.base_tree.get_reference_revision(file_id)
 
430
                sub_merge.base_tree = \
 
431
                    sub_tree.branch.repository.revision_tree(base_revision)
 
432
                sub_merge.base_rev_id = base_revision
 
433
                sub_merge.do_merge()
 
434
        
416
435
    def do_merge(self):
417
436
        self.this_tree.lock_tree_write()
418
 
        if self.base_tree is not None:
419
 
            self.base_tree.lock_read()
420
 
        if self.other_tree is not None:
421
 
            self.other_tree.lock_read()
422
437
        try:
423
 
            merge = self.make_merger()
424
 
            merge.do_merge()
425
 
            if self.recurse == 'down':
426
 
                for relpath, file_id in self.this_tree.iter_references():
427
 
                    sub_tree = self.this_tree.get_nested_tree(file_id, relpath)
428
 
                    other_revision = self.other_tree.get_reference_revision(
429
 
                        file_id, relpath)
430
 
                    if  other_revision == sub_tree.last_revision():
431
 
                        continue
432
 
                    sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)
433
 
                    sub_merge.merge_type = self.merge_type
434
 
                    other_branch = self.other_branch.reference_parent(file_id, relpath)
435
 
                    sub_merge.set_other_revision(other_revision, other_branch)
436
 
                    base_revision = self.base_tree.get_reference_revision(file_id)
437
 
                    sub_merge.base_tree = \
438
 
                        sub_tree.branch.repository.revision_tree(base_revision)
439
 
                    sub_merge.base_rev_id = base_revision
440
 
                    sub_merge.do_merge()
441
 
 
442
 
        finally:
443
 
            if self.other_tree is not None:
444
 
                self.other_tree.unlock()
445
438
            if self.base_tree is not None:
446
 
                self.base_tree.unlock()
 
439
                self.base_tree.lock_read()
 
440
            try:
 
441
                if self.other_tree is not None:
 
442
                    self.other_tree.lock_read()
 
443
                try:
 
444
                    merge = self.make_merger()
 
445
                    self._do_merge_to(merge)
 
446
                finally:
 
447
                    if self.other_tree is not None:
 
448
                        self.other_tree.unlock()
 
449
            finally:
 
450
                if self.base_tree is not None:
 
451
                    self.base_tree.unlock()
 
452
        finally:
447
453
            self.this_tree.unlock()
448
454
        if len(merge.cooked_conflicts) == 0:
449
455
            if not self.ignore_zero and not is_quiet():