external_repo: use RepoTree for fetch/import/get (#3841)

* erepo: load external repos directly from git tree

* erepo: add fetch_external

* remote/RepoTree: add callback for keeping track of download counts when
saving tree to cache

* repo: use erepo.fetch_external() in repo.fetch()

* erepo: return cache save_infos in fetch_external

* DependencyRepo: use erepo.fetch_external and cache.checkout instead of
pull_to

* erepo: remove pull_to

* DvcTree: support granularity for isdir()

* DvcTree: fix indentation bug

* RepoTree: add copytree() method

* LocalRemote: use working tree for local cache walk_files

* repo: state should be noop for GitTree based erepos

* erepo: add get_external()

* test_get: remove unneeded caplog check

* erepo: add get_rev()

* tests: fix erepo test bug

* ls: use RepoTree

* remote: support trees in _collect_dir

* remote: support trees in get_dir_checksum

* RepoTree: fix dir_cache relpaths in windows

* remote: fix duplicated fetch bug

* utils: don't skip md5 dos2unix check for git blobs

* otherwise md5 checksums will not match when comparing git version to
  cached filesystem version on windows
This commit is contained in:
Peter Rowlands (변기호)
2020-05-22 17:23:31 +03:00
committed by GitHub
parent 21a3efe2c7
commit b7cd785eba
13 changed files with 344 additions and 259 deletions
+2 -6
View File
@@ -157,17 +157,13 @@ def test_get_to_dir(tmp_dir, erepo_dir, dname):
assert (tmp_dir / dname / "file").read_text() == "contents"
def test_get_from_non_dvc_master(tmp_dir, git_dir, caplog):
def test_get_from_non_dvc_master(tmp_dir, git_dir):
with git_dir.chdir(), git_dir.branch("branch", new=True):
git_dir.init(dvc=True)
git_dir.dvc_gen("some_file", "some text", commit="create some file")
caplog.clear()
Repo.get(os.fspath(git_dir), "some_file", out="some_dst", rev="branch")
with caplog.at_level(logging.INFO, logger="dvc"):
Repo.get(os.fspath(git_dir), "some_file", out="some_dst", rev="branch")
assert caplog.text == ""
assert (tmp_dir / "some_dst").read_text() == "some text"