summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2016-07-27 00:23:02 +0000
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2016-07-27 00:23:02 +0000
commite336c186ca44ea640206eb3cb626a92fcc1dde2b (patch)
treeec463991526141c02d7cfbc66899883ae16a3d83
parent51da0f08047aaa0d68bd645c4fd6c0249d3119cb (diff)
downloadmorph-e336c186ca44ea640206eb3cb626a92fcc1dde2b.tar.gz
Add support for '--repo' and '--ref' in list-artifactsbaserock/pedroalvarez/repo-ref-options
Change-Id: I48cebf0007e602c0262b667643c3290d41c7b485
-rw-r--r--morphlib/plugins/list_artifacts_plugin.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/morphlib/plugins/list_artifacts_plugin.py b/morphlib/plugins/list_artifacts_plugin.py
index 9e09e2b9..e28b7e42 100644
--- a/morphlib/plugins/list_artifacts_plugin.py
+++ b/morphlib/plugins/list_artifacts_plugin.py
@@ -38,11 +38,22 @@ class ListArtifactsPlugin(cliapp.Plugin):
Command line arguments:
- * `MORPH` is a system morphology name at that ref.
+ * `MORPH` is a system morphology name in the checked-out repository
+ or in a remote repostory.
+
+ Available options:
+
+ * `--repo=REPO`` is a git repository URL.
+ * `--ref=REF` is a branch or other commit reference in that repository.
+ * `--local-changes=LOCAL-CHANGES` option to `ignore` or `include`
+ uncommitted/unpushed local changes.
You can pass multiple values for `MORPH`, in which case the command
outputs the union of the build graphs of all the systems passed in.
+ If not `REPO` and `REF` specified, it will look into the current
+ working directory for a Definitions checkout.
+
The output includes any meta-artifacts such as .meta and .build-log
files.
@@ -55,6 +66,20 @@ class ListArtifactsPlugin(cliapp.Plugin):
'Wrong number of arguments to list-artifacts command '
'(see help)')
+
+ repo = self.app.settings['repo']
+ ref = self.app.settings['ref']
+
+ if bool(repo) ^ bool(ref):
+ raise cliapp.AppException(
+ '--repo and --ref work toghether, use both please.')
+
+ if repo and ref:
+ system_filenames = map(morphlib.util.sanitise_morphology_path,
+ args)
+ self._list_artifacts(repo, ref, system_filenames)
+ return
+
definitions_repo = morphlib.definitions_repo.open(
'.', search_for_root=True, app=self.app)