From 10dcca207438f284e21e5010de6ae0f766a0fa83 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Fri, 5 Dec 2014 10:16:35 +0000 Subject: Fix `morph help-extensions` returning no items We were passing a nonsensical value for the 'kind' parameter so it would always return an empty list. --- morphlib/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphlib/app.py b/morphlib/app.py index 3f4171a4..930e023d 100644 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -432,7 +432,7 @@ class Morph(cliapp.Application): self._help(True) def help_extensions(self, args): - exts = extensions.list_extensions(self.settings['build-ref-prefix']) + exts = extensions.list_extensions() template = "Extensions:\n %s\n" ext_string = '\n '.join(exts) self.output.write(template % (ext_string)) -- cgit v1.2.1 From 203623a34055c41aed529d50c24fb4a99714ccb7 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Fri, 5 Dec 2014 11:45:02 +0000 Subject: Fix `morph help-extensions` run outside a workspace This command would use the sysbranchdir.open_from_within() function call to search for a system branch, which traverses all subdirectories looking for a directory. This is useful behaviour, but if the user ran `morph help-extensions` in / it'd traverse their whole filesystem before returning, which is stupid. This change means it only does the traverse if it already detected a workspace. --- morphlib/extensions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/morphlib/extensions.py b/morphlib/extensions.py index b270d304..051a54a7 100644 --- a/morphlib/extensions.py +++ b/morphlib/extensions.py @@ -38,6 +38,7 @@ class ExtensionNotExecutableError(ExtensionError): pass def _get_root_repo(): + workspace = morphlib.workspace.open('.') system_branch = morphlib.sysbranchdir.open_from_within('.') root_repo_dir = morphlib.gitdir.GitDirectory( system_branch.get_git_directory_name( @@ -77,7 +78,8 @@ def _list_extensions(kind): try: repo_extension_filenames = \ _list_repo_extension_filenames(kind) - except (sysbranchdir.NotInSystemBranch): + except (morphlib.workspace.NotInWorkspace, + sysbranchdir.NotInSystemBranch): # Squash this and just return no system branch extensions pass morph_extension_filenames = _list_morph_extension_filenames(kind) -- cgit v1.2.1