mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-26 23:09:35 +01:00
dvc: add 'dvc checkout'
Fixes #225 Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
@@ -17,6 +17,7 @@ from dvc.command.instance_create import CmdInstanceCreate
|
||||
from dvc.command.config import CmdConfig
|
||||
from dvc.command.show_pipeline import CmdShowPipeline
|
||||
from dvc.command.merge import CmdMerge
|
||||
from dvc.command.checkout import CmdCheckout
|
||||
from dvc import VERSION
|
||||
|
||||
|
||||
@@ -412,6 +413,13 @@ def parse_args(argv=None):
|
||||
help='Merge')
|
||||
merge_parser.set_defaults(func=CmdMerge)
|
||||
|
||||
# Checkout
|
||||
checkout_parser = subparsers.add_parser(
|
||||
'checkout',
|
||||
parents=[parent_parser],
|
||||
help='Checkout')
|
||||
checkout_parser.set_defaults(func=CmdCheckout)
|
||||
|
||||
if isinstance(argv, str):
|
||||
argv = argv.split()
|
||||
|
||||
|
||||
@@ -48,3 +48,17 @@ class PathFactory(object):
|
||||
externally_created_files.append(file)
|
||||
|
||||
return result, externally_created_files
|
||||
|
||||
def all_existing_data_items(self):
|
||||
items = []
|
||||
states = []
|
||||
|
||||
for root, dirs, files in os.walk(self._config.state_dir):
|
||||
for fname in files:
|
||||
states.append(os.path.join(root, fname))
|
||||
|
||||
for state in states:
|
||||
data = os.path.relpath(state, self._config.state_dir)[:-len(DataItem.STATE_FILE_SUFFIX)]
|
||||
items.append(self.existing_data_item_from_dvc_path(data))
|
||||
|
||||
return items
|
||||
|
||||
Reference in New Issue
Block a user