diff --git a/dvc/commands/data.py b/dvc/commands/data.py index f940bdb23..d9565f67c 100644 --- a/dvc/commands/data.py +++ b/dvc/commands/data.py @@ -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." diff --git a/dvc/repo/data.py b/dvc/repo/data.py index 13ab78641..beed6c25d 100644 --- a/dvc/repo/data.py +++ b/dvc/repo/data.py @@ -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: diff --git a/pyproject.toml b/pyproject.toml index 8874273d0..6b30306f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/tests/unit/command/test_data_status.py b/tests/unit/command/test_data_status.py index f8109c93b..b28d4f903 100644 --- a/tests/unit/command/test_data_status.py +++ b/tests/unit/command/test_data_status.py @@ -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, )