Keep status output format consistents (#4490)

fix#4482
According to the discussion. Make `DVC status [outputs]` output format the same with `DVC status [stages]` instead of `DVC status -c [outputs]`
This commit is contained in:
karajan1001
2020-08-31 00:03:21 +03:00
committed by GitHub
parent e2b5ab996f
commit 777a23afac
3 changed files with 11 additions and 10 deletions
+3 -5
View File
@@ -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
+5 -4
View File
@@ -469,13 +469,13 @@ class Stage(params.StageParams):
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 {}
@@ -494,8 +494,9 @@ class Stage(params.StageParams):
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})
+3 -1
View File
@@ -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"}}]
}