mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-26 07:18:31 +01:00
dvc: introduce protected mode
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]>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
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
|
||||
Reference in New Issue
Block a user