data: status: introduce --remote-refresh

This commit is contained in:
Ruslan Kuprieiev
2023-02-21 12:32:40 +02:00
parent 3043b6588f
commit 968a8fde99
4 changed files with 13 additions and 2 deletions
+7
View File
@@ -118,6 +118,7 @@ class CmdDataStatus(CmdBase):
granular=self.args.granular,
untracked_files=self.args.untracked_files,
not_in_remote=self.args.not_in_remote,
remote_refresh=self.args.remote_refresh,
)
if not self.args.unchanged:
@@ -249,6 +250,12 @@ def add_parser(subparsers, parent_parser):
default=False,
help="Show files missing from remote.",
)
data_status_parser.add_argument(
"--remote-refresh",
action="store_true",
default=False,
help="Refresh remote index.",
)
data_status_parser.set_defaults(func=CmdDataStatus)
DATA_LS_HELP = "List data tracked by DVC with its metadata."
+4 -1
View File
@@ -60,6 +60,7 @@ def _diff(
granular: bool = False,
not_in_cache: bool = False,
not_in_remote: bool = False,
remote_refresh: bool = False,
) -> Dict[str, List[str]]:
from dvc_data.index import StorageError
from dvc_data.index.diff import UNCHANGED, UNKNOWN, diff
@@ -109,7 +110,9 @@ def _diff(
not_in_remote
and change.old
and change.old.hash_info
and not old.storage_map.remote_exists(change.old)
and not old.storage_map.remote_exists(
change.old, refresh=remote_refresh
)
):
_add_change("not_in_remote", change)
except StorageError:
+1 -1
View File
@@ -35,7 +35,7 @@ dependencies = [
"configobj>=5.0.6",
"distro>=1.3",
"dpath<3,>=2.0.2",
"dvc-data>=0.41.1,<0.42",
"dvc-data>=0.41.3,<0.42",
"dvc-http",
"dvc-render>=0.1.2",
"dvc-studio-client>=0.1.1",
+1
View File
@@ -52,6 +52,7 @@ def test_cli(dvc, mocker, mocked_status):
status.assert_called_once_with(
untracked_files="all",
not_in_remote=False,
remote_refresh=False,
granular=True,
)