From 1af150a5e95a17224b63f66319faea626bdfba88 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Mon, 12 Jun 2023 15:00:56 +0300 Subject: [PATCH] index: use out.hash_info for complete imports --- dvc/repo/index.py | 6 +++++- dvc/testing/workspace_tests.py | 2 ++ pyproject.toml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dvc/repo/index.py b/dvc/repo/index.py index dacae838d..265e4278f 100644 --- a/dvc/repo/index.py +++ b/dvc/repo/index.py @@ -136,7 +136,11 @@ def _load_data_from_outs(index, prefix, outs): if out.stage.is_import and not out.stage.is_repo_import: dep = out.stage.deps[0] entry.meta = dep.meta - entry.hash_info = dep.hash_info + if out.hash_info: + entry.hash_info = out.hash_info + else: + # partial import + entry.hash_info = dep.hash_info # FIXME PyGTrie-based DataIndex doesn't remove entry.key during # index.add, so we have to set the entry manually here to make diff --git a/dvc/testing/workspace_tests.py b/dvc/testing/workspace_tests.py index b574af139..dfbe633bf 100644 --- a/dvc/testing/workspace_tests.py +++ b/dvc/testing/workspace_tests.py @@ -150,6 +150,8 @@ class TestImportURLVersionAware: dvc.pull() assert (tmp_dir / "data_dir" / "subdir" / "file").read_text() == "file" + + dvc.commit(force=True) assert dvc.status() == {} diff --git a/pyproject.toml b/pyproject.toml index c3fd05aaf..4f72a8572 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ dependencies = [ "configobj>=5.0.6", "distro>=1.3", "dpath<3,>=2.1.0", - "dvc-data>=1.7.0,<1.8.0", + "dvc-data>=1.8.0,<1.9.0", "dvc-http>=2.29.0", "dvc-render>=0.3.1,<1", "dvc-studio-client>=0.9.2,<1",