data status: exclude remote status by default

This commit is contained in:
dberenbaum
2023-05-06 18:21:11 +03:00
committed by Ruslan Kuprieiev
parent 8ecc66ae9a
commit 2db07b047e
4 changed files with 21 additions and 6 deletions
+9 -2
View File
@@ -117,6 +117,7 @@ class CmdDataStatus(CmdBase):
status = self.repo.data_status( status = self.repo.data_status(
granular=self.args.granular, granular=self.args.granular,
untracked_files=self.args.untracked_files, untracked_files=self.args.untracked_files,
not_in_remote=self.args.not_in_remote,
remote_refresh=self.args.remote_refresh, remote_refresh=self.args.remote_refresh,
) )
@@ -244,10 +245,16 @@ def add_parser(subparsers, parent_parser):
help="Show untracked files.", help="Show untracked files.",
) )
data_status_parser.add_argument( data_status_parser.add_argument(
"--remote-refresh", "--not-in-remote",
action="store_true", action="store_true",
default=False, default=False,
help="Refresh remote index.", help="Show files not in remote.",
)
data_status_parser.add_argument(
"--no-remote-refresh",
dest="remote_refresh",
action="store_false",
help="Use cached remote index (don't check remote).",
) )
data_status_parser.set_defaults(func=CmdDataStatus) data_status_parser.set_defaults(func=CmdDataStatus)
-1
View File
@@ -172,7 +172,6 @@ def _diff_index_to_wtree(repo: "Repo", **kwargs: Any) -> Dict[str, List[str]]:
repo.index.data["repo"], repo.index.data["repo"],
workspace, workspace,
not_in_cache=True, not_in_cache=True,
not_in_remote=True,
**kwargs, **kwargs,
) )
+10 -2
View File
@@ -402,7 +402,13 @@ 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({"dir": {"foo": "foo", "bar": "bar"}})
tmp_dir.dvc_gen("foobar", "foobar") tmp_dir.dvc_gen("foobar", "foobar")
assert dvc.data_status(untracked_files="all") == { assert dvc.data_status() == {
**EMPTY_STATUS,
"committed": {"added": M.unordered("foobar", join("dir", ""))},
"git": M.dict(),
}
assert dvc.data_status(untracked_files="all", not_in_remote=True) == {
**EMPTY_STATUS, **EMPTY_STATUS,
"untracked": M.unordered("foobar.dvc", "dir.dvc", ".gitignore"), "untracked": M.unordered("foobar.dvc", "dir.dvc", ".gitignore"),
"committed": {"added": M.unordered("foobar", join("dir", ""))}, "committed": {"added": M.unordered("foobar", join("dir", ""))},
@@ -410,7 +416,9 @@ def test_missing_remote_cache(M, tmp_dir, dvc, scm, local_remote):
"git": M.dict(), "git": M.dict(),
} }
assert dvc.data_status(granular=True, untracked_files="all") == { assert dvc.data_status(
granular=True, untracked_files="all", not_in_remote=True
) == {
**EMPTY_STATUS, **EMPTY_STATUS,
"untracked": M.unordered("foobar.dvc", "dir.dvc", ".gitignore"), "untracked": M.unordered("foobar.dvc", "dir.dvc", ".gitignore"),
"committed": { "committed": {
+2 -1
View File
@@ -51,7 +51,8 @@ def test_cli(dvc, mocker, mocked_status):
assert cmd.run() == 0 assert cmd.run() == 0
status.assert_called_once_with( status.assert_called_once_with(
untracked_files="all", untracked_files="all",
remote_refresh=False, not_in_remote=False,
remote_refresh=True,
granular=True, granular=True,
) )