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(-) (limited to 'morphlib') 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