get: fix override external repo cache type

This commit is contained in:
Ivan Shcheklein
2019-11-05 16:27:01 -08:00
parent 73f95ee6b4
commit c25715dc72
2 changed files with 20 additions and 6 deletions
+1 -6
View File
@@ -3,7 +3,6 @@ import os
import shortuuid
from dvc.config import Config
from dvc.exceptions import GetDVCFileError
from dvc.exceptions import NotDvcRepoError
from dvc.exceptions import OutputNotFoundError
@@ -48,11 +47,7 @@ def get(url, path, out=None, rev=None):
#
# Also, we can't use theoretical "move" link type here, because
# the same cache file might be used a few times in a directory.
repo.config.set(
Config.SECTION_CACHE,
Config.SECTION_CACHE_TYPE,
"reflink,hardlink,copy",
)
repo.cache.local.cache_types = ["reflink", "hardlink", "copy"]
o = repo.find_out_by_relpath(path)
with repo.state:
+19
View File
@@ -5,9 +5,11 @@ import os
import pytest
from dvc.config import Config
from dvc.exceptions import GetDVCFileError
from dvc.exceptions import UrlNotDvcRepoError
from dvc.repo import Repo
from dvc.system import System
from dvc.utils import makedirs
from tests.utils import trees_equal
@@ -34,6 +36,23 @@ def test_get_repo_dir(repo_dir, erepo):
trees_equal(src, dst)
def test_cache_type_is_properly_overridden(repo_dir, erepo):
erepo.dvc.config.set(
Config.SECTION_CACHE, Config.SECTION_CACHE_TYPE, "symlink"
)
erepo.dvc.scm.add([erepo.dvc.config.config_file])
erepo.dvc.scm.commit("set cache type to symlinks")
src = erepo.FOO
dst = erepo.FOO + "_imported"
Repo.get(erepo.root_dir, src, dst)
assert not System.is_symlink(dst)
assert os.path.exists(dst)
assert os.path.isfile(dst)
def test_get_repo_rev(repo_dir, erepo):
src = "version"
dst = src