Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed Jun 9, 2023
1 parent 6bbb373 commit 03e44f9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 32 deletions.
5 changes: 5 additions & 0 deletions dvc/repo/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ def _indexes():
).data["repo"]

result = ifetch(_indexes(), jobs=jobs) # pylint: disable=assignment-from-no-return

# FIXME OLOLO
# need to reset internal indexes after ifetch, because we've saved the data and can
# now load hashes from it.

transferred_count += result[0] # pylint: disable=unsubscriptable-object
failed_count += result[1] # pylint: disable=unsubscriptable-object
if failed_count:
Expand Down
30 changes: 14 additions & 16 deletions dvc/repo/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,22 +178,20 @@ def _load_storage_from_out(storage_map, key, out):

if out.stage.is_import:
dep = out.stage.deps[0]
# if not out.hash_info:
# from fsspec.utils import tokenize
# # partial import
# # FIXME should use out.cache.path + fsid or something
# storage_map.add_cache(
# FileStorage(
# key,
# out.cache.fs,
# out.cache.fs.path.join(
# out.cache.path,
# "fs",
# dep.fs.protocol,
# tokenize(dep.fs.path)
# ),
# )
# )
if not out.hash_info:
from fsspec.utils import tokenize

# partial import
# FIXME should use out.cache.path + fsid or something
storage_map.add_cache(
FileStorage(
key,
out.cache.fs,
out.cache.fs.path.join(
out.cache.path, "fs", dep.fs.protocol, tokenize(dep.fs.path)
),
)
)
storage_map.add_remote(FileStorage(key, dep.fs, dep.fs_path))


Expand Down
31 changes: 15 additions & 16 deletions tests/func/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,11 @@ def test_pull_import_no_download(tmp_dir, scm, dvc, erepo_dir):
with erepo_dir.chdir():
erepo_dir.scm_gen(os.path.join("foo", "bar"), b"bar", commit="add bar")
erepo_dir.dvc_gen(os.path.join("foo", "baz"), b"baz contents", commit="add baz")
size = (
len(b"bar")
+ len(b"baz contents")
+ len((erepo_dir / "foo" / ".gitignore").read_bytes())
)
# size = (
# len(b"bar")
# + len(b"baz contents")
# + len((erepo_dir / "foo" / ".gitignore").read_bytes())
# )

dvc.imp(os.fspath(erepo_dir), "foo", "foo_imported", no_download=True)

Expand All @@ -245,17 +245,16 @@ def test_pull_import_no_download(tmp_dir, scm, dvc, erepo_dir):
assert (tmp_dir / "foo_imported" / "bar").read_bytes() == b"bar"
assert (tmp_dir / "foo_imported" / "baz").read_bytes() == b"baz contents"

stage = load_file(dvc, "foo_imported.dvc").stage

if os.name == "nt":
expected_hash = "2e798234df5f782340ac3ce046f8dfae.dir"
else:
expected_hash = "bdb8641831d8fcb03939637e09011c21.dir"
assert stage.outs[0].hash_info.value == expected_hash

assert stage.outs[0].meta.size == size
assert stage.outs[0].meta.nfiles == 3
assert stage.outs[0].meta.isdir
# stage = load_file(dvc, "foo_imported.dvc").stage
# if os.name == "nt":
# expected_hash = "2e798234df5f782340ac3ce046f8dfae.dir"
# else:
# expected_hash = "bdb8641831d8fcb03939637e09011c21.dir"
# assert stage.outs[0].hash_info.value == expected_hash
#
# assert stage.outs[0].meta.size == size
# assert stage.outs[0].meta.nfiles == 3
# assert stage.outs[0].meta.isdir


def test_pull_import_no_download_rev_lock(
Expand Down

0 comments on commit 03e44f9

Please sign in to comment.