diff --git a/dvc/commands/data.py b/dvc/commands/data.py index 223222bea..b1ff26ced 100644 --- a/dvc/commands/data.py +++ b/dvc/commands/data.py @@ -31,14 +31,22 @@ class CmdDataStatus(CmdBase): "unchanged": "DVC unchanged files", } HINTS = { - "not_in_cache": 'use "dvc pull ..." to download files', - "committed": "git commit the corresponding dvc files " - "to update the repo", - "uncommitted": 'use "dvc commit ..." to track changes', - "untracked": 'use "git add ..." or ' - 'dvc add ..." to commit to git or to dvc', - "git_dirty": "there are {}changes not tracked by dvc, " - 'use "git status" to see', + "not_in_cache": ('use "dvc fetch ..." to download files',), + "committed": ( + "git commit the corresponding dvc files to update the repo", + ), + "uncommitted": ( + 'use "dvc commit ..." to track changes', + 'use "dvc checkout ..." to discard changes', + ), + "untracked": ( + 'use "git add ..." or ' + 'dvc add ..." to commit to git or to dvc', + ), + "git_dirty": ( + "there are {}changes not tracked by dvc, " + 'use "git status" to see', + ), } @staticmethod @@ -75,8 +83,9 @@ class CmdDataStatus(CmdBase): color = cls.COLORS.get(stage, None) ui.write(header) - if hint := cls.HINTS.get(stage): - ui.write(f" ({hint})") + if hints := cls.HINTS.get(stage): + for hint in hints: + ui.write(f" ({hint})") if isinstance(stage_status, dict): items = [ @@ -91,9 +100,10 @@ class CmdDataStatus(CmdBase): out = "\n".join(tabs + item for item in chunk) ui.write(colorize(out, color)) - if (hint := cls.HINTS.get("git_dirty")) and git_info.get("is_dirty"): - message = hint.format("other " if result else "") - ui.write(f"[blue]({message})[/]", styled=True) + if (hints := cls.HINTS.get("git_dirty")) and git_info.get("is_dirty"): + for hint in hints: + message = hint.format("other " if result else "") + ui.write(f"[blue]({message})[/]", styled=True) return 0 def run(self) -> int: diff --git a/tests/unit/command/test_data_status.py b/tests/unit/command/test_data_status.py index 8f466f8c9..1f7b09edc 100644 --- a/tests/unit/command/test_data_status.py +++ b/tests/unit/command/test_data_status.py @@ -110,7 +110,7 @@ def test_show_status(dvc, scm, mocker, capsys, mocked_status, args, is_dirty): out, err = capsys.readouterr() expected_out = """\ Not in cache: - (use "dvc pull ..." to download files) + (use "dvc fetch ..." to download files) notincache DVC committed changes: @@ -123,6 +123,7 @@ DVC committed changes: DVC uncommitted changes: (use "dvc commit ..." to track changes) + (use "dvc checkout ..." to discard changes) added: dir/baz modified: dir/bar deleted: dir/foobar