diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-08-05 15:40:15 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-08-06 16:28:18 +0100 |
commit | 54f558d657131278baaecc02b60f9d05d88dc89d (patch) | |
tree | 6bc6741b7534ac4946ae577efa15df1d6d4a7c07 /morphlib | |
parent | faac98c8ae8773defbf2b7ba104c6e56d67e3c31 (diff) | |
download | morph-54f558d657131278baaecc02b60f9d05d88dc89d.tar.gz |
Re-implement "morph show-system-branch" using new infrastructure
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/plugins/branch_and_merge_new_plugin.py | 9 | ||||
-rw-r--r-- | morphlib/plugins/branch_and_merge_plugin.py | 8 |
2 files changed, 9 insertions, 8 deletions
diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py index 353f0bcc..40686aee 100644 --- a/morphlib/plugins/branch_and_merge_new_plugin.py +++ b/morphlib/plugins/branch_and_merge_new_plugin.py @@ -31,6 +31,8 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): self.app.add_subcommand('workspace', self.workspace, arg_synopsis='') self.app.add_subcommand( 'checkout', self.checkout, arg_synopsis='REPO BRANCH') + self.app.add_subcommand( + 'show-system-branch', self.show_system_branch, arg_synopsis='') def disable(self): pass @@ -134,6 +136,13 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): self._remove_branch_dir_safe(ws.root, root_dir) raise + def show_system_branch(self, args): + '''Show the name of the current system branch.''' + + ws = morphlib.workspace.open('.') + sb = morphlib.sysbranchdir.open_from_within('.') + self.app.output.write('%s\n' % sb.system_branch_name) + def _remove_branch_dir_safe(self, workspace_root, system_branch_root): # This function avoids throwing any exceptions, so it is safe to call # inside an 'except' block without altering the backtrace. diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py index 0485f317..6da5b09a 100644 --- a/morphlib/plugins/branch_and_merge_plugin.py +++ b/morphlib/plugins/branch_and_merge_plugin.py @@ -85,8 +85,6 @@ class BranchAndMergePlugin(cliapp.Plugin): arg_synopsis='-- COMMAND [ARGS...]') # Plumbing commands (FIXME: should be hidden from --help by default) - 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='') @@ -1960,12 +1958,6 @@ class BranchAndMergePlugin(cliapp.Plugin): raise cliapp.AppException( 'Command failed at repo %s: %s' % (repo, ' '.join(args))) - def show_system_branch(self, args): - '''Show the name of the current system branch.''' - - branch, dirname = self.deduce_system_branch() - self.app.output.write('%s\n' % branch) - def show_branch_root(self, args): '''Show the name of the repository holding the system morphologies. |