summaryrefslogtreecommitdiff
path: root/morphlib/plugins
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-07-31 12:03:40 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-07-31 16:05:19 +0000
commit0f77afae8b89d3ef57053562d37364c118d9e519 (patch)
tree3c4aabf4b992d22afd4c8d521a403409d716b435 /morphlib/plugins
parent339c05186f49d0203618b5979cf4e76d6d1fc3e6 (diff)
downloadmorph-0f77afae8b89d3ef57053562d37364c118d9e519.tar.gz
Re-implement "morph workspace" using the Workspace class
Put new implementation into new branch and merge plugin, and remove old implementation from the old plugin. Also change the error message for the NotInWorkspace exception, so that it matches what the test suite expects. It's a crappy error message, I think, but I don't want to change external behaviour during refactoring.
Diffstat (limited to 'morphlib/plugins')
-rw-r--r--morphlib/plugins/branch_and_merge_new_plugin.py7
-rw-r--r--morphlib/plugins/branch_and_merge_plugin.py7
2 files changed, 7 insertions, 7 deletions
diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py
index 2c92156f..fb3be920 100644
--- a/morphlib/plugins/branch_and_merge_new_plugin.py
+++ b/morphlib/plugins/branch_and_merge_new_plugin.py
@@ -25,6 +25,7 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin):
def enable(self):
self.app.add_subcommand('init', self.init, arg_synopsis='[DIR]')
+ self.app.add_subcommand('workspace', self.workspace, arg_synopsis='')
def disable(self):
pass
@@ -61,3 +62,9 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin):
ws = morphlib.workspace.create(args[0])
self.app.status(msg='Initialized morph workspace', chatty=True)
+ def workspace(self, args):
+ '''Show the toplevel directory of the current workspace.'''
+
+ ws = morphlib.workspace.open('.')
+ self.app.output.write('%s\n' % ws.root)
+
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py
index 2121885f..d39f815c 100644
--- a/morphlib/plugins/branch_and_merge_plugin.py
+++ b/morphlib/plugins/branch_and_merge_plugin.py
@@ -87,8 +87,6 @@ class BranchAndMergePlugin(cliapp.Plugin):
arg_synopsis='-- COMMAND [ARGS...]')
# 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,
@@ -1999,11 +1997,6 @@ class BranchAndMergePlugin(cliapp.Plugin):
raise cliapp.AppException(
'Command failed at repo %s: %s' % (repo, ' '.join(args)))
- def workspace(self, args):
- '''Show the toplevel directory of the current workspace.'''
-
- self.app.output.write('%s\n' % self.deduce_workspace())
-
def show_system_branch(self, args):
'''Show the name of the current system branch.'''