data: status: introduce --not-in-remote

Also supports cloud versioning.

Fixes #8761
This commit is contained in:
Ruslan Kuprieiev
2023-02-20 12:25:17 +02:00
parent b76aad8d56
commit c34cbf63af
4 changed files with 76 additions and 4 deletions
+38
View File
@@ -13,6 +13,7 @@ EMPTY_STATUS = {
"uncommitted": {},
"git": {},
"not_in_cache": [],
"not_in_remote": [],
"unchanged": [],
"untracked": [],
}
@@ -81,6 +82,7 @@ def test_directory(M, tmp_dir, dvc, scm):
}
assert dvc.data_status(granular=True, untracked_files="all") == {
**EMPTY_STATUS,
"committed": {
"added": M.unordered(
join("dir", "bar"),
@@ -396,6 +398,42 @@ def test_missing_dir_object_from_index(M, tmp_dir, dvc, scm):
}
def test_missing_remote_cache(M, tmp_dir, dvc, scm, local_remote):
tmp_dir.dvc_gen({"dir": {"foo": "foo", "bar": "bar"}})
tmp_dir.dvc_gen("foobar", "foobar")
assert dvc.data_status(untracked_files="all", not_in_remote=True) == {
**EMPTY_STATUS,
"untracked": M.unordered("foobar.dvc", "dir.dvc", ".gitignore"),
"committed": {"added": M.unordered("foobar", join("dir", ""))},
"not_in_remote": M.unordered("foobar", join("dir", "")),
"git": M.dict(),
}
assert dvc.data_status(
granular=True, untracked_files="all", not_in_remote=True
) == {
**EMPTY_STATUS,
"untracked": M.unordered("foobar.dvc", "dir.dvc", ".gitignore"),
"committed": {
"added": M.unordered(
"foobar",
join("dir", ""),
join("dir", "foo"),
join("dir", "bar"),
)
},
"uncommitted": {},
"not_in_remote": M.unordered(
"foobar",
join("dir", ""),
join("dir", "foo"),
join("dir", "bar"),
),
"git": M.dict(),
}
def test_root_from_dir_to_file(M, tmp_dir, dvc, scm):
tmp_dir.dvc_gen({"data": {"foo": "foo", "bar": "bar"}})
remove("data")
+1
View File
@@ -51,6 +51,7 @@ def test_cli(dvc, mocker, mocked_status):
assert cmd.run() == 0
status.assert_called_once_with(
untracked_files="all",
not_in_remote=False,
granular=True,
)