Skip to content

Commit

Permalink
Keep status output format consistents (iterative#4490)
Browse files Browse the repository at this point in the history
fix#4482
According to the discussion. Make `DVC status [outputs]` output format the same with `DVC status [stages]` instead of `DVC status -c [outputs]`
  • Loading branch information
karajan1001 authored Aug 30, 2020
1 parent e2b5ab9 commit 777a23a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
8 changes: 3 additions & 5 deletions dvc/repo/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ def _joint_status(pairs):
"{} is frozen. Its dependencies are"
" not going to be shown in the status output.".format(stage)
)
if not filter_info:
status_info.update(stage.status(check_updates=True))
else:
for out in stage.filter_outs(filter_info):
status_info.update(out.status())
status_info.update(
stage.status(check_updates=True, filter_info=filter_info)
)

return status_info

Expand Down
9 changes: 5 additions & 4 deletions dvc/stage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,13 +469,13 @@ def _checkout(out, **kwargs):
return "failed", exc.target_infos

@rwlocked(read=["deps", "outs"])
def status(self, check_updates=False):
def status(self, check_updates=False, filter_info=None):
ret = []
show_import = self.is_repo_import and check_updates

if not self.frozen or show_import:
self._status_deps(ret)
self._status_outs(ret)
self._status_outs(ret, filter_info=filter_info)
self._status_always_changed(ret)
self._status_stage(ret)
return {self.addressing: ret} if ret else {}
Expand All @@ -494,8 +494,9 @@ def _status_deps(self, ret):
if deps_status:
ret.append({"changed deps": deps_status})

def _status_outs(self, ret):
outs_status = self._status(self.outs)
def _status_outs(self, ret, filter_info):
filter_outs = self.filter_outs(filter_info)
outs_status = self._status(filter_outs)
if outs_status:
ret.append({"changed outs": outs_status})

Expand Down
4 changes: 3 additions & 1 deletion tests/func/test_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,6 @@ def test_status_outputs(tmp_dir, dvc):
]
}

assert dvc.status(targets=["alice"]) == {"alice": "modified"}
assert dvc.status(targets=["alice"]) == {
"alice_bob": [{"changed outs": {"alice": "modified"}}]
}

0 comments on commit 777a23a

Please sign in to comment.