62
65
return project_wt, lib_wt
64
def do_merge_into(self, location, merge_as=None):
65
"""Invoke merge_into_helper."""
66
operation = cleanup.OperationWithCleanups(merge.merge_into_helper)
67
return operation.run_simple(location, operation.add_cleanup, merge_as)
67
def do_merge_into(self, location, merge_as):
68
"""Helper for using MergeIntoMerger.
70
:param location: location of directory to merge from, either the
71
location of a branch or of a path inside a branch.
72
:param merge_as: the path in a tree to add the new directory as.
73
:returns: the conflicts from 'do_merge'.
75
operation = cleanup.OperationWithCleanups(self._merge_into)
76
return operation.run(location, merge_as)
78
def _merge_into(self, op, location, merge_as):
79
# Open and lock the various tree and branch objects
80
wt, subdir_relpath = workingtree.WorkingTree.open_containing(merge_as)
81
op.add_cleanup(wt.lock_write().unlock)
82
branch_to_merge, subdir_to_merge = _mod_branch.Branch.open_containing(
84
op.add_cleanup(branch_to_merge.lock_read().unlock)
85
other_tree = branch_to_merge.basis_tree()
86
op.add_cleanup(other_tree.lock_read().unlock)
88
merger = merge.MergeIntoMerger(this_tree=wt, other_tree=other_tree,
89
other_branch=branch_to_merge, target_subdir=subdir_relpath,
90
source_subpath=subdir_to_merge)
91
merger.set_base_revision(_mod_revision.NULL_REVISION, branch_to_merge)
92
conflicts = merger.do_merge()
69
96
def assertTreeEntriesEqual(self, expected_entries, tree):
70
97
"""Assert that 'tree' contains the expected inventory entries.