1from __future__ import unicode_literals 2 3import dvc.logger as logger 4from dvc.exceptions import DvcException 5from dvc.command.base import CmdBase 6 7 8class CmdUnprotect(CmdBase): 9 def run(self): 10 for target in self.args.targets: 11 try: 12 self.repo.unprotect(target) 13 except DvcException: 14 msg = "failed to unprotect '{}'".format(target) 15 logger.error(msg) 16 return 1 17 return 0 18 19 20def add_parser(subparsers, parent_parser): 21 UNPROTECT_HELP = "Unprotect data file/directory." 22 unprotect_parser = subparsers.add_parser( 23 "unprotect", 24 parents=[parent_parser], 25 description=UNPROTECT_HELP, 26 help=UNPROTECT_HELP, 27 ) 28 unprotect_parser.add_argument( 29 "targets", nargs="+", help="Data files/directory." 30 ) 31 unprotect_parser.set_defaults(func=CmdUnprotect) 32