diff options
-rw-r--r-- | morphlib/plugins/branch_and_merge_plugin.py | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py index 6713fce9..3b52abe1 100644 --- a/morphlib/plugins/branch_and_merge_plugin.py +++ b/morphlib/plugins/branch_and_merge_plugin.py @@ -36,17 +36,12 @@ class BranchAndMergePlugin(cliapp.Plugin): self.init_changelog() def enable(self): + # User-facing commands self.app.add_subcommand('init', self.init, arg_synopsis='[DIR]') - self.app.add_subcommand('workspace', self.workspace, - arg_synopsis='') self.app.add_subcommand('branch', self.branch, arg_synopsis='REPO NEW [OLD]') self.app.add_subcommand('checkout', self.checkout, arg_synopsis='REPO BRANCH') - self.app.add_subcommand('show-system-branch', self.show_system_branch, - arg_synopsis='') - self.app.add_subcommand('show-branch-root', self.show_branch_root, - arg_synopsis='') self.app.add_subcommand('merge', self.merge, arg_synopsis='BRANCH') self.app.add_subcommand('edit', self.edit, @@ -55,9 +50,19 @@ class BranchAndMergePlugin(cliapp.Plugin): self.app.add_subcommand('unpetrify', self.unpetrify) self.app.add_subcommand('build', self.build, arg_synopsis='SYSTEM') + + # Advanced commands self.app.add_subcommand('foreach', self.foreach, arg_synopsis='COMMAND') + # Plumbing commands (FIXME: should be hidden from --help by default) + self.app.add_subcommand('workspace', self.workspace, + arg_synopsis='') + self.app.add_subcommand('show-system-branch', self.show_system_branch, + arg_synopsis='') + self.app.add_subcommand('show-branch-root', self.show_branch_root, + arg_synopsis='') + def disable(self): pass @@ -472,11 +477,6 @@ class BranchAndMergePlugin(cliapp.Plugin): os.mkdir(os.path.join(dirname, '.morph')) self.app.status(msg='Initialized morph workspace', chatty=True) - def workspace(self, args): - '''Find morph workspace directory from current working directory.''' - - self.app.output.write('%s\n' % self.deduce_workspace()) - def branch(self, args): '''Branch the whole system.''' @@ -560,20 +560,6 @@ class BranchAndMergePlugin(cliapp.Plugin): self.remove_branch_dir_safe(workspace, system_branch) raise - def show_system_branch(self, args): - '''Print name of current system branch.''' - - branch, dirname = self.deduce_system_branch() - self.app.output.write('%s\n' % branch) - - def show_branch_root(self, args): - '''Print name of the repository that was branched off from.''' - - workspace = self.deduce_workspace() - system_branch, branch_dir = self.deduce_system_branch() - branch_root = self.get_branch_config(branch_dir, 'branch.root') - self.app.output.write('%s\n' % branch_root) - def checkout_repository(self, branch_dir, repo, ref, parent_ref=None): '''Make a chunk or stratum repository available for a system branch @@ -1342,3 +1328,22 @@ class BranchAndMergePlugin(cliapp.Plugin): self.app.output.write(error) raise cliapp.AppException( 'Command failed at repo %s: %s' % (repo, ' '.join(args))) + + def workspace(self, args): + '''Find morph workspace directory from current working directory.''' + + self.app.output.write('%s\n' % self.deduce_workspace()) + + def show_system_branch(self, args): + '''Print name of current system branch.''' + + branch, dirname = self.deduce_system_branch() + self.app.output.write('%s\n' % branch) + + def show_branch_root(self, args): + '''Print name of the repository that was branched off from.''' + + workspace = self.deduce_workspace() + system_branch, branch_dir = self.deduce_system_branch() + branch_root = self.get_branch_config(branch_dir, 'branch.root') + self.app.output.write('%s\n' % branch_root) |