4039
4039
return stored_location
4042
class cmd_merge_into(Command):
4043
"""Merge a branch into a subdirectory of the current one.
4045
LOCATION is the branch that will be merged into this one.
4046
SUBDIR is the subdirectory that will be used for merging.
4047
(defaults to basename of LOCATION)
4049
After running 'bzr merge-into OTHER SUBDIR' all of the files from OTHER will be
4050
present underneath the subdirectory SUBDIR.
4053
takes_args = ['location', 'subdir?', 'only?']
4056
def run(self, location, subdir=None, only=None):
4057
# Open and lock the various tree and branch objects
4058
if not subdir: # default to same name as source dir
4059
subdir = os.path.basename(location)
4060
wt, subdir_relpath = WorkingTree.open_containing(subdir)
4062
self.add_cleanup(wt.unlock)
4063
branch_to_merge = Branch.open(location)
4064
branch_to_merge.lock_read()
4065
self.add_cleanup(branch_to_merge.unlock)
4066
other_tree = branch_to_merge.basis_tree()
4067
other_tree.lock_read()
4068
self.add_cleanup(other_tree.unlock)
4072
merger = _mod_merge.MergeIntoMerger(this_tree=wt,
4073
other_tree=other_tree, other_branch=branch_to_merge,
4074
target_subdir=subdir_relpath, source_subpath=only)
4075
merger.set_base_revision(
4076
_mod_revision.NULL_REVISION, branch_to_merge)
4077
conflicts = merger.do_merge()
4078
merger.set_pending()
4079
# Report the results
4081
self.outf.write('merge-into successful\n')
4083
self.outf.write('merge-into conflicts: %s\n' % (conflicts,))
4042
4087
class cmd_remerge(Command):
4043
4088
__doc__ = """Redo a merge.