mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
* test: clean flake8 config root clutter * test: pre-commit: add isort Compatible with black (see https://github.com/timothycrosley/isort/issues/694) * lint: reorder imports * lint: more complex imports * lint: fix deepsource * config: isort: add first party dvc * tests: restyled: add isort * temp commit to revert before merge * Revert "temp commit to revert before merge" This reverts commit 11db0fd8e95fe891597cbb9bf804480909b19e24.
41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
import argparse
|
|
import logging
|
|
|
|
from dvc.command.base import CmdBase, append_doc_link
|
|
from dvc.exceptions import DvcException
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class CmdUpdate(CmdBase):
|
|
def run(self):
|
|
ret = 0
|
|
for target in self.args.targets:
|
|
try:
|
|
self.repo.update(target, self.args.rev)
|
|
except DvcException:
|
|
logger.exception("failed to update '{}'.".format(target))
|
|
ret = 1
|
|
return ret
|
|
|
|
|
|
def add_parser(subparsers, parent_parser):
|
|
UPDATE_HELP = "Update data artifacts imported from other DVC repositories."
|
|
update_parser = subparsers.add_parser(
|
|
"update",
|
|
parents=[parent_parser],
|
|
description=append_doc_link(UPDATE_HELP, "update"),
|
|
help=UPDATE_HELP,
|
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
)
|
|
update_parser.add_argument(
|
|
"targets", nargs="+", help="DVC-files to update."
|
|
)
|
|
update_parser.add_argument(
|
|
"--rev",
|
|
nargs="?",
|
|
help="Git revision (e.g. SHA, branch, tag)",
|
|
metavar="<commit>",
|
|
)
|
|
update_parser.set_defaults(func=CmdUpdate)
|