~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

(broken) merge aaron's workingtree format changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
3171
3171
            raise errors.BzrCommandError("bzr serve requires one of --inet or --port")
3172
3172
        server.serve()
3173
3173
 
 
3174
class cmd_join(Command):
 
3175
    """Combine a subtree into its containing tree.
 
3176
    
 
3177
    This is marked as a merge of the subtree into the containing tree, and all
 
3178
    history is preserved.
 
3179
    """
 
3180
 
 
3181
    takes_args = ['tree']
 
3182
    takes_options = [Option('reference', 'join by reference')]
 
3183
 
 
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]
 
3188
        if reference:
 
3189
            try: 
 
3190
                containing_tree.add_reference(sub_tree)
 
3191
            except errors.BadReferenceTarget:
 
3192
                raise errors.BzrCommandError("Cannot join %s.  %s" % 
 
3193
                                             (tree, e.reason))
 
3194
        else:
 
3195
            try:
 
3196
                containing_tree.subsume(sub_tree)
 
3197
            except errors.BadSubsumeSource, e:
 
3198
                raise errors.BzrCommandError("Cannot join %s.  %s" % 
 
3199
                                             (tree, e.reason))
 
3200
 
 
3201
 
 
3202
class cmd_split(Command):
 
3203
    """Split a tree into two trees.
 
3204
    """
 
3205
 
 
3206
    takes_args = ['tree']
 
3207
 
 
3208
    def run(self, tree):
 
3209
        containing_tree, subdir = WorkingTree.open_containing(tree)
 
3210
        sub_id = containing_tree.path2id(subdir)
 
3211
        if sub_id is None:
 
3212
            raise errors.NotVersionedError(subdir)
 
3213
        try:
 
3214
            containing_tree.extract(sub_id)
 
3215
        except errors.RootNotRich:
 
3216
            raise errors.UpgradeRequired(containing_tree.branch.base)
 
3217
 
 
3218
 
3174
3219
 
3175
3220
# command-line interpretation helper for merge-related commands
3176
3221
def _merge_helper(other_revision, base_revision,