Merge pull request #2231 from efiop/2146

checkout: safe_remove output if no checksum is found
This commit is contained in:
Ruslan Kuprieiev
2019-07-06 02:25:38 +03:00
committed by GitHub
2 changed files with 11 additions and 2 deletions
+5 -2
View File
@@ -767,8 +767,11 @@ class RemoteBASE(object):
checksum = checksum_info.get(self.PARAM_CHECKSUM)
if not checksum:
msg = "No checksum info for '{}'."
logger.debug(msg.format(str(path_info)))
logger.warning(
"No checksum info found for '{}'. "
"It won't be created.".format(str(path_info))
)
self.safe_remove(path_info, force=force)
return
if not self.changed(path_info, checksum_info):
+6
View File
@@ -575,3 +575,9 @@ class TestCheckoutMovedCacheDirWithSymlinks(TestDvc):
relpath(old_data_link, old_cache_dir),
relpath(new_data_link, new_cache_dir),
)
def test_checkout_no_checksum(repo_dir, dvc_repo):
stage = dvc_repo.run(outs=[repo_dir.FOO], no_exec=True, cmd="somecmd")
dvc_repo.checkout(stage.path, force=True)
assert not os.path.exists(repo_dir.FOO)