mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-27 15:28:30 +01:00
erepo: refactor download/fetch logic (#5234)
* erepo: don't use _get_tree_for * erepo: refactor download/fetch logic * dvc: unify handling existing output
This commit is contained in:
@@ -4,6 +4,7 @@ from unittest.mock import call
|
||||
import pytest
|
||||
|
||||
from dvc.external_repo import external_repo
|
||||
from dvc.path_info import PathInfo
|
||||
from tests.unit.tree.test_repo import make_subrepo
|
||||
|
||||
|
||||
@@ -96,6 +97,13 @@ def test_fetch_external_repo_jobs(tmp_dir, scm, mocker, dvc, local_remote):
|
||||
|
||||
with external_repo(str(tmp_dir)) as repo:
|
||||
spy = mocker.spy(repo.cloud, "pull")
|
||||
repo.fetch_external(["dir1"], jobs=3)
|
||||
|
||||
dvc.cache.local.save(
|
||||
PathInfo(repo.root_dir) / "dir1",
|
||||
repo.repo_tree,
|
||||
None,
|
||||
follow_subrepos=False,
|
||||
jobs=3,
|
||||
)
|
||||
run_jobs = tuple(spy.call_args_list[0])[1].get("jobs")
|
||||
assert run_jobs == 3
|
||||
|
||||
@@ -377,7 +377,9 @@ def test_subrepos(tmp_dir, scm, dvc):
|
||||
True,
|
||||
[
|
||||
PathInfo("dir") / "repo" / "foo.dvc",
|
||||
PathInfo("dir") / "repo" / ".dvcignore",
|
||||
PathInfo("dir") / "repo" / "dir1.dvc",
|
||||
PathInfo("dir") / "repo2" / ".dvcignore",
|
||||
PathInfo("dir") / "repo2" / "lorem.dvc",
|
||||
PathInfo("dir") / "repo2" / "dir2.dvc",
|
||||
],
|
||||
@@ -409,12 +411,10 @@ def test_subrepo_walk(tmp_dir, scm, dvc, dvcfiles, extra_expected):
|
||||
PathInfo("dir") / "repo",
|
||||
PathInfo("dir") / "repo.txt",
|
||||
PathInfo("dir") / "repo2",
|
||||
PathInfo("dir") / "repo" / ".dvcignore",
|
||||
PathInfo("dir") / "repo" / ".gitignore",
|
||||
PathInfo("dir") / "repo" / "foo",
|
||||
PathInfo("dir") / "repo" / "dir1",
|
||||
PathInfo("dir") / "repo" / "dir1" / "bar",
|
||||
PathInfo("dir") / "repo2" / ".dvcignore",
|
||||
PathInfo("dir") / "repo2" / ".gitignore",
|
||||
PathInfo("dir") / "repo2" / "lorem",
|
||||
PathInfo("dir") / "repo2" / "dir2",
|
||||
@@ -583,7 +583,7 @@ def test_walk_nested_subrepos(tmp_dir, dvc, scm, traverse_subrepos):
|
||||
for repo_dir in subrepos:
|
||||
make_subrepo(repo_dir, scm)
|
||||
|
||||
extras = {".dvcignore", ".gitignore"} # these files are always there
|
||||
extras = {".gitignore"} # these files are always there
|
||||
expected = {}
|
||||
for repo_dir in subrepos + [tmp_dir]:
|
||||
base = os.path.basename(repo_dir)
|
||||
|
||||
Reference in New Issue
Block a user