cli: move push/pull from under 'dvc cache'

Fixes #528

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2018-03-08 14:03:49 +02:00
parent 1248b56f44
commit 2e21c39c00
3 changed files with 14 additions and 23 deletions
+5 -14
View File
@@ -138,38 +138,29 @@ def parse_args(argv=None):
default=None,
help='DVC files.')
# Cache
cache_parser = subparsers.add_parser(
'cache',
parents=[parent_parser],
help='Cache operations')
cache_subparsers = cache_parser.add_subparsers(
dest='cmd',
help='Use `dvc cache CMD` --help for command-specific help')
# Pull
pull_parser = cache_subparsers.add_parser(
pull_parser = subparsers.add_parser(
'pull',
parents=[parent_cache_parser],
help='Pull data files from the cloud')
pull_parser.set_defaults(func=CmdDataPull)
# Push
push_parser = cache_subparsers.add_parser(
push_parser = subparsers.add_parser(
'push',
parents=[parent_cache_parser],
help='Push data files to the cloud')
push_parser.set_defaults(func=CmdDataPush)
#Fetch
fetch_parser = cache_subparsers.add_parser(
# Fetch
fetch_parser = subparsers.add_parser(
'fetch',
parents=[parent_cache_parser],
help='Fetch data files from the cloud')
fetch_parser.set_defaults(func=CmdDataFetch)
# Status
status_parser = cache_subparsers.add_parser(
status_parser = subparsers.add_parser(
'status',
parents=[parent_cache_parser],
help='Show mismatches between local cache and cloud cache')
+3 -3
View File
@@ -62,19 +62,19 @@ class TestRun(TestDvc):
class TestPull(TestDvc):
def test(self):
args = parse_args(['cache', 'pull'])
args = parse_args(['pull'])
self.assertIsInstance(args.func(args), CmdDataPull)
class TestPush(TestDvc):
def test(self):
args = parse_args(['cache', 'push'])
args = parse_args(['push'])
self.assertIsInstance(args.func(args), CmdDataPush)
class TestStatus(TestDvc):
def test(self):
args = parse_args(['cache', 'status'])
args = parse_args(['status'])
self.assertIsInstance(args.func(args), CmdDataStatus)
+6 -6
View File
@@ -204,26 +204,26 @@ class TestDataCloudLocalCli(TestDvc):
cache_dir = stage_dir.outs[0].cache
#FIXME check status output
self.main(['cache', 'status'])
self.main(['status'])
self.main(['cache', 'push'])
self.main(['push'])
self.assertTrue(os.path.exists(cache))
self.assertTrue(os.path.isfile(cache))
self.assertTrue(os.path.isfile(cache_dir))
self.main(['cache', 'status'])
self.main(['status'])
os.chmod(cache, 0o777)
os.unlink(cache)
self.dvc._remove_cache(cache_dir)
self.main(['cache', 'status'])
self.main(['status'])
self.main(['cache', 'pull'])
self.main(['pull'])
self.assertTrue(os.path.exists(cache))
self.assertTrue(os.path.isfile(cache))
with open(cache, 'r') as fd:
self.assertEqual(fd.read(), self.FOO_CONTENTS)
self.assertTrue(os.path.isfile(cache_dir))
self.main(['cache', 'status'])
self.main(['status'])