Repository: iterative/dvc

Issue:
pipeline show: in outputs (--outs) mode prints dependencies
Version:

```
DVC version: 0.88.0+79aa61
Python version: 3.7.6
Platform: Darwin-18.2.0-x86_64-i386-64bit
Binary: False
Package: None
Filesystem type (workspace): ('apfs', '/dev/disk1s1')
```

Issue:

See here:

https://github.com/iterative/dvc.org/pull/1065

Actual output is the one we have in the docs now.



Discussion:

Patch:
diff --git a/dvc/command/pipeline.py b/dvc/command/pipeline.py
index 027f82954..6aedb086a 100644
--- a/dvc/command/pipeline.py
+++ b/dvc/command/pipeline.py
@@ -48,26 +48,21 @@ class CmdPipelineShow(CmdBase):
             elif outs:
                 for out in stage.outs:
                     nodes.add(str(out))
-                for dep in stage.deps:
-                    nodes.add(str(dep))
             else:
                 nodes.add(stage.relpath)
 
         edges = []
-
-        if outs:
-            for stage in networkx.dfs_preorder_nodes(G, target_stage):
-                for dep in stage.deps:
-                    for out in stage.outs:
-                        edges.append((str(out), str(dep)))
-        else:
-            for from_stage, to_stage in networkx.edge_dfs(G, target_stage):
-                if commands:
-                    if to_stage.cmd is None:
-                        continue
-                    edges.append((from_stage.cmd, to_stage.cmd))
-                else:
-                    edges.append((from_stage.relpath, to_stage.relpath))
+        for from_stage, to_stage in networkx.edge_dfs(G, target_stage):
+            if commands:
+                if to_stage.cmd is None:
+                    continue
+                edges.append((from_stage.cmd, to_stage.cmd))
+            elif outs:
+                for from_out in from_stage.outs:
+                    for to_out in to_stage.outs:
+                        edges.append((str(from_out), str(to_out)))
+            else:
+                edges.append((from_stage.relpath, to_stage.relpath))
 
         return list(nodes), edges, networkx.is_tree(G)
 


Test patch:
diff --git a/tests/func/test_pipeline.py b/tests/func/test_pipeline.py
index 64d099ba5..51ee639fb 100644
--- a/tests/func/test_pipeline.py
+++ b/tests/func/test_pipeline.py
@@ -239,15 +239,18 @@ class TestDvcRepoPipeline(TestDvc):
         self.assertEqual(len(pipelines), 0)
 
 
-def test_split_pipeline(tmp_dir, dvc):
+def test_split_pipeline(tmp_dir, scm, dvc):
+    tmp_dir.scm_gen("git_dep1", "git_dep1")
+    tmp_dir.scm_gen("git_dep2", "git_dep2")
+
     tmp_dir.dvc_gen("data", "source file content")
     dvc.run(
-        deps=["data"],
+        deps=["git_dep1", "data"],
         outs=["data_train", "data_valid"],
         cmd="echo train >> data_train && echo valid >> data_valid",
     )
     stage = dvc.run(
-        deps=["data_train", "data_valid"],
+        deps=["git_dep2", "data_train", "data_valid"],
         outs=["result"],
         cmd="echo result >> result",
     )