diff --git a/dvc/repo/gc.py b/dvc/repo/gc.py index 5f988244d..29f399240 100644 --- a/dvc/repo/gc.py +++ b/dvc/repo/gc.py @@ -17,9 +17,8 @@ def _do_gc(typ, func, clist): def _raise_error_if_all_disabled(**kwargs): if not any(kwargs.values()): raise InvalidArgumentError( - "Invalid Arguments. Either of ({}) needs to be enabled.".format( - ", ".join(kwargs.keys()) - ) + "Either of `-w|--workspace`, `-a|--all-branches`, `-T|--all-tags` " + "or `--all-commits` needs to be set." ) diff --git a/dvc/repo/init.py b/dvc/repo/init.py index 3710ad344..3238bb8e9 100644 --- a/dvc/repo/init.py +++ b/dvc/repo/init.py @@ -5,7 +5,7 @@ import colorama from dvc import analytics from dvc.config import Config -from dvc.exceptions import InitError +from dvc.exceptions import InitError, InvalidArgumentError from dvc.repo import Repo from dvc.scm import SCM from dvc.scm.base import SCMError @@ -65,7 +65,7 @@ def init(root_dir=os.curdir, no_scm=False, force=False, subdir=False): """ if no_scm and subdir: - raise InitError( + raise InvalidArgumentError( "Cannot initialize repo with `--no-scm` and `--subdir`" ) diff --git a/dvc/repo/reproduce.py b/dvc/repo/reproduce.py index f0c3b96ec..b14245822 100644 --- a/dvc/repo/reproduce.py +++ b/dvc/repo/reproduce.py @@ -62,7 +62,7 @@ def reproduce( if not target and not all_pipelines: raise InvalidArgumentError( - "Neither target nor all_pipelines are specified." + "Neither `target` nor `--all-pipelines` are specified." ) interactive = kwargs.get("interactive", False) diff --git a/dvc/repo/status.py b/dvc/repo/status.py index 3528e6243..b8c3a8fcf 100644 --- a/dvc/repo/status.py +++ b/dvc/repo/status.py @@ -3,7 +3,7 @@ from itertools import compress from funcy.py3 import cat -from dvc.exceptions import DvcException +from dvc.exceptions import InvalidArgumentError from . import locked @@ -127,7 +127,7 @@ def status( ) ) if ignored: - msg = "the following options are meaningless for local status: {}" - raise DvcException(msg.format(", ".join(ignored))) + msg = "The following options are meaningless for local status: {}" + raise InvalidArgumentError(msg.format(", ".join(ignored))) return _local_status(self, targets, with_deps=with_deps) diff --git a/tests/func/test_gc.py b/tests/func/test_gc.py index c6dba9d73..acb3bb94e 100644 --- a/tests/func/test_gc.py +++ b/tests/func/test_gc.py @@ -265,14 +265,20 @@ def test_gc_without_workspace(tmp_dir, dvc, caplog): with caplog.at_level(logging.WARNING, logger="dvc"): assert main(["gc", "-vf"]) == 255 - assert "Invalid Arguments" in caplog.text + assert ( + "Either of `-w|--workspace`, `-a|--all-branches`, `-T|--all-tags` " + "or `--all-commits` needs to be set." + ) in caplog.text def test_gc_cloud_without_any_specifier(tmp_dir, dvc, caplog): with caplog.at_level(logging.WARNING, logger="dvc"): assert main(["gc", "-cvf"]) == 255 - assert "Invalid Arguments" in caplog.text + assert ( + "Either of `-w|--workspace`, `-a|--all-branches`, `-T|--all-tags` " + "or `--all-commits` needs to be set." + ) in caplog.text def test_gc_with_possible_args_positive(tmp_dir, dvc):