3171
3171
raise errors.BzrCommandError("bzr serve requires one of --inet or --port")
3174
class cmd_join(Command):
3175
"""Combine a subtree into its containing tree.
3177
This is marked as a merge of the subtree into the containing tree, and all
3178
history is preserved.
3181
takes_args = ['tree']
3182
takes_options = [Option('reference', 'join by reference')]
3184
def run(self, tree, reference=False):
3185
sub_tree = WorkingTree.open(tree)
3186
parent_dir = osutils.dirname(sub_tree.basedir)
3187
containing_tree = WorkingTree.open_containing(parent_dir)[0]
3190
containing_tree.add_reference(sub_tree)
3191
except errors.BadReferenceTarget:
3192
raise errors.BzrCommandError("Cannot join %s. %s" %
3196
containing_tree.subsume(sub_tree)
3197
except errors.BadSubsumeSource, e:
3198
raise errors.BzrCommandError("Cannot join %s. %s" %
3202
class cmd_split(Command):
3203
"""Split a tree into two trees.
3206
takes_args = ['tree']
3208
def run(self, tree):
3209
containing_tree, subdir = WorkingTree.open_containing(tree)
3210
sub_id = containing_tree.path2id(subdir)
3212
raise errors.NotVersionedError(subdir)
3214
containing_tree.extract(sub_id)
3215
except errors.RootNotRich:
3216
raise errors.UpgradeRequired(containing_tree.branch.base)
3175
3220
# command-line interpretation helper for merge-related commands
3176
3221
def _merge_helper(other_revision, base_revision,