dependency: repo: try to fetch before staging (#5549)

Related to https://github.com/iterative/dvc-bench/issues/234
This commit is contained in:
Ruslan Kuprieiev
2021-03-05 01:03:33 +02:00
committed by GitHub
parent 1e7df0c27e
commit 06aad3e2b3
4 changed files with 22 additions and 38 deletions
+11 -2
View File
@@ -81,9 +81,18 @@ def _collect_dir(path_info, fs, name, state, **kwargs):
return dir_info
def get_dir_hash(path_info, fs, name, state, **kwargs):
def get_dir_hash(path_info, fs, name, odb, state, **kwargs):
from . import Tree
value = fs.info(path_info).get(name)
if value:
hash_info = HashInfo(name, value)
try:
Tree.load(odb, hash_info)
return hash_info
except FileNotFoundError:
pass
dir_info = _collect_dir(path_info, fs, name, state, **kwargs)
hash_info = Tree.save_dir_info(fs.repo.odb.local, dir_info)
hash_info.size = dir_info.size
@@ -125,7 +134,7 @@ def get_hash(path_info, fs, name, odb, **kwargs):
return hash_info
if fs.isdir(path_info):
hash_info = get_dir_hash(path_info, fs, name, state, **kwargs)
hash_info = get_dir_hash(path_info, fs, name, odb, state, **kwargs)
else:
hash_info = get_file_hash(path_info, fs, name)