From 4218f858538e3d46d4e1da02ab31a8582a8e956f Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Sun, 27 Jan 2019 22:20:49 -0600 Subject: [PATCH] status: --quiet reflects changes on its exit code Fix #1519 --- dvc/command/status.py | 5 ++++- tests/test_status.py | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tests/test_status.py diff --git a/dvc/command/status.py b/dvc/command/status.py index fb8cce33f..d68bb9e92 100644 --- a/dvc/command/status.py +++ b/dvc/command/status.py @@ -35,7 +35,10 @@ class CmdDataStatus(CmdDataBase): all_tags=self.args.all_tags, with_deps=self.args.with_deps) if st: - self._show(st, indent) + if self.args.quiet: + return 1 + else: + self._show(st, indent) else: logger.info(self.UP_TO_DATE_MSG) diff --git a/tests/test_status.py b/tests/test_status.py new file mode 100644 index 000000000..4999ce6e2 --- /dev/null +++ b/tests/test_status.py @@ -0,0 +1,19 @@ +import os + +from dvc.main import main + +from tests.basic_env import TestDvc + + +class TestStatus(TestDvc): + def test_quiet(self): + self.dvc.add(self.FOO) + + ret = main(['status', '--quiet']) + self.assertEqual(ret, 0) + + os.remove(self.FOO) + os.rename(self.BAR, self.FOO) + + ret = main(['status', '--quiet']) + self.assertEqual(ret, 1)