diff --git a/dvc/cli.py b/dvc/cli.py index 127fc7a18..c2ed031af 100644 --- a/dvc/cli.py +++ b/dvc/cli.py @@ -564,11 +564,17 @@ def parse_args(argv=None): 'show', parents=[parent_parser], help='Show pipeline') - pipeline_show_parser.add_argument('-c', + pipeline_show_parser_group = pipeline_show_parser.add_mutually_exclusive_group() + pipeline_show_parser_group.add_argument('-c', '--commands', action='store_true', default=False, help='Print commands instead of paths to DVC files.') + pipeline_show_parser_group.add_argument('-o', + '--outs', + action='store_true', + default=False, + help='Print output files instead of paths to DVC files.') pipeline_show_parser.add_argument( 'targets', nargs='+', diff --git a/dvc/command/pipeline.py b/dvc/command/pipeline.py index 4137ab5c1..bba28d6ec 100644 --- a/dvc/command/pipeline.py +++ b/dvc/command/pipeline.py @@ -7,7 +7,7 @@ from dvc.project import NotDvcFileError class CmdPipelineShow(CmdBase): - def _show(self, target, commands): + def _show(self, target, commands, outs): G = self.project.graph()[0] stages = networkx.get_node_attributes(G, 'stage') node = os.path.relpath(os.path.abspath(target), self.project.root_dir) @@ -15,15 +15,18 @@ class CmdPipelineShow(CmdBase): raise NotDvcFileError(node) for n in networkx.dfs_postorder_nodes(G, node): - line = n if commands: - line = stages[n].cmd - self.project.logger.info(line) + self.project.logger.info(stages[n].cmd) + elif outs: + for out in stages[n].outs: + self.project.logger.info(out.rel_path) + else: + self.project.logger.info(n) def run(self, unlock=False): for target in self.args.targets: try: - self._show(target, self.args.commands) + self._show(target, self.args.commands, self.args.outs) except DvcException as ex: msg = 'Failed to show pipeline for \'{}\''.format(target) self.project.logger.error(msg, ex) diff --git a/dvc/project.py b/dvc/project.py index 0bb2fb494..66c0d8366 100644 --- a/dvc/project.py +++ b/dvc/project.py @@ -360,6 +360,11 @@ class Project(object): stages = self.active_stages() for stage in stages: + if not stage.locked: + msg = 'DVC file \'{}\' is locked. Its dependecies are not ' \ + 'going to be shown in status output.' + self.logger.warn(msg.format(stage.relpath)) + status.update(stage.status()) return status