summaryrefslogtreecommitdiff
path: root/morphlib/plugins/branch_and_merge_plugin.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2012-10-12 14:39:06 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2012-10-12 17:27:09 +0100
commita6bc2829211ceda1f07386d381e67a983fbb063b (patch)
tree95d09d441e2513a3ff9c7e5cc24e5c61c7136a90 /morphlib/plugins/branch_and_merge_plugin.py
parent5a430fdf91be1c569d1f1b8d8e3de929a20c2e1b (diff)
downloadmorph-a6bc2829211ceda1f07386d381e67a983fbb063b.tar.gz
Reorder branch and merge plumbing commands to end of file
Users do not need these now due to 'morph status' existing. However, they are still useful for scripts to call.
Diffstat (limited to 'morphlib/plugins/branch_and_merge_plugin.py')
-rw-r--r--morphlib/plugins/branch_and_merge_plugin.py55
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)