mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-26 23:09:35 +01:00
This is an opt-in mode, that will make data in the workspace read-only, thus protecting cache from corruption when hardlinks or symlinks are used. User can use `dvc unprotect file` command, to replace read-only link to cache with an editable copy. We can use this for now to decide if we want to go with a `unified workflow` in the future or if we want to set unprotected `reflink,copy` by default. Fixes #799 Signed-off-by: Ruslan Kuprieiev <[email protected]>
15 lines
428 B
Python
15 lines
428 B
Python
from dvc.exceptions import DvcException
|
|
from dvc.command.base import CmdBase
|
|
|
|
|
|
class CmdUnprotect(CmdBase):
|
|
def run(self):
|
|
for target in self.args.targets:
|
|
try:
|
|
self.project.unprotect(target)
|
|
except DvcException as ex:
|
|
msg = "Failed to unprotect '{}'".format(target)
|
|
self.project.logger.error(msg, ex)
|
|
return 1
|
|
return 0
|