diff options
-rw-r--r-- | morphlib/plugins/branch_and_merge_new_plugin.py | 18 | ||||
-rw-r--r-- | morphlib/plugins/branch_and_merge_plugin.py | 20 |
2 files changed, 18 insertions, 20 deletions
diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py index 40686aee..479bd2f9 100644 --- a/morphlib/plugins/branch_and_merge_new_plugin.py +++ b/morphlib/plugins/branch_and_merge_new_plugin.py @@ -33,6 +33,8 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): '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='') def disable(self): pass @@ -143,6 +145,22 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): sb = morphlib.sysbranchdir.open_from_within('.') self.app.output.write('%s\n' % sb.system_branch_name) + def show_branch_root(self, args): + '''Show the name of the repository holding the system morphologies. + + This would, for example, write out something like: + + /src/ws/master/baserock:baserock/morphs + + when the master branch of the `baserock:baserock/morphs` + repository is checked out. + + ''' + + ws = morphlib.workspace.open('.') + sb = morphlib.sysbranchdir.open_from_within('.') + self.app.output.write('%s\n' % sb.get_config('branch.root')) + 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 6da5b09a..6f3a8c87 100644 --- a/morphlib/plugins/branch_and_merge_plugin.py +++ b/morphlib/plugins/branch_and_merge_plugin.py @@ -84,10 +84,6 @@ class BranchAndMergePlugin(cliapp.Plugin): self.app.add_subcommand('foreach', self.foreach, arg_synopsis='-- COMMAND [ARGS...]') - # Plumbing commands (FIXME: should be hidden from --help by default) - self.app.add_subcommand('show-branch-root', self.show_branch_root, - arg_synopsis='') - def disable(self): pass @@ -1958,19 +1954,3 @@ class BranchAndMergePlugin(cliapp.Plugin): raise cliapp.AppException( 'Command failed at repo %s: %s' % (repo, ' '.join(args))) - def show_branch_root(self, args): - '''Show the name of the repository holding the system morphologies. - - This would, for example, write out something like: - - /src/ws/master/baserock:baserock/morphs - - when the master branch of the `baserock:baserock/morphs` - repository is checked out. - - ''' - - 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) |