dvc: add pull/push commands

We already have 'sync' command, but users report it to be confusing
when both local and remote files exist, so lets introduce two direct
commands to implicitly push and pull from cloud.

Fixes #157.

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2017-08-12 22:44:10 +03:00
parent a234311980
commit db43e6bc91
4 changed files with 70 additions and 18 deletions
+27 -8
View File
@@ -10,7 +10,7 @@ from dvc.command.init import CmdInit
from dvc.command.remove import CmdRemove
from dvc.command.run import CmdRun
from dvc.command.repro import CmdRepro
from dvc.command.data_sync import CmdDataSync
from dvc.command.data_sync import CmdDataSync, CmdDataPush, CmdDataPull
from dvc.command.lock import CmdLock
from dvc.command.gc import CmdGC
from dvc.command.import_file import CmdImportFile
@@ -121,22 +121,41 @@ def parse_args(argv=None):
help='Arguments of a command')
run_parser.set_defaults(func=CmdRun)
# Sync
sync_parser = subparsers.add_parser(
'sync',
parents=[parent_parser],
help='Synchronize data file with cloud (cloud settings already setup.')
sync_parser.add_argument(
# Parent parser used in sync/pull/push
parent_sync_parser = argparse.ArgumentParser(
add_help=False,
parents=[parent_parser])
parent_sync_parser.add_argument(
'targets',
nargs='+',
help='File or directory to sync.')
sync_parser.add_argument('-j',
parent_sync_parser.add_argument('-j',
'--jobs',
type=int,
default=cpu_count(),
help='Number of jobs to run simultaneously.')
# Sync
sync_parser = subparsers.add_parser(
'sync',
parents=[parent_sync_parser],
help='Synchronize data file with cloud (cloud settings already setup.')
sync_parser.set_defaults(func=CmdDataSync)
# Pull
pull_parser = subparsers.add_parser(
'pull',
parents=[parent_sync_parser],
help='Pull data files from the cloud')
pull_parser.set_defaults(func=CmdDataPull)
# Push
push_parser = subparsers.add_parser(
'push',
parents=[parent_sync_parser],
help='Push data files to the cloud')
push_parser.set_defaults(func=CmdDataPush)
# Repro
repro_parser = subparsers.add_parser(
'repro',