diff --git a/dvc/commands/dag.py b/dvc/commands/dag.py index 8d4f87bfe..585e870ca 100644 --- a/dvc/commands/dag.py +++ b/dvc/commands/dag.py @@ -23,6 +23,7 @@ def _show_dot(G): from networkx.drawing.nx_pydot import write_dot + G = G.reverse() dot_file = io.StringIO() write_dot(G, dot_file) return dot_file.getvalue() diff --git a/tests/unit/command/test_dag.py b/tests/unit/command/test_dag.py index 7a23d1167..d5ea26a23 100644 --- a/tests/unit/command/test_dag.py +++ b/tests/unit/command/test_dag.py @@ -143,12 +143,12 @@ def test_show_dot(repo): "stage;\n" "stage;\n" "stage;\n" - "\"stage: '1'\" -> \"stage: 'a.dvc'\";\n" - "\"stage: '2'\" -> \"stage: 'b.dvc'\";\n" - "\"stage: '3'\" -> \"stage: 'a.dvc'\";\n" - "\"stage: '3'\" -> \"stage: 'b.dvc'\";\n" - "\"stage: '4'\" -> \"stage: 'a.dvc'\";\n" - "\"stage: '4'\" -> \"stage: '3'\";\n" + "\"stage: 'b.dvc'\" -> \"stage: '2'\";\n" + "\"stage: 'b.dvc'\" -> \"stage: '3'\";\n" + "\"stage: 'a.dvc'\" -> \"stage: '1'\";\n" + "\"stage: 'a.dvc'\" -> \"stage: '3'\";\n" + "\"stage: 'a.dvc'\" -> \"stage: '4'\";\n" + "\"stage: '3'\" -> \"stage: '4'\";\n" "}\n" )