449
449
change_reporter=self.change_reporter,
452
def _do_merge_to(self, 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(
459
if other_revision == sub_tree.last_revision():
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
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()
459
merge = self.make_merger()
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(
466
if other_revision == sub_tree.last_revision():
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
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()
477
if self.other_tree is not None:
478
self.other_tree.lock_read()
480
merge = self.make_merger()
481
self._do_merge_to(merge)
483
if self.other_tree is not None:
484
self.other_tree.unlock()
486
if self.base_tree is not None:
487
self.base_tree.unlock()
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():