dvc.objects: move hashing functions to dvc.objects

This commit moves `HashedStreamReader`/`get_hash_file`/`file_md5`
into `dvc.objects.hash`.

The `get_hash_file` has been renamed to `hash_file`.
This also copies `relpath` and `is_exec` to the `dvc.fs.utils`.
This commit is contained in:
Saugat Pachhai (सौगात)
2022-05-12 20:33:18 +03:00
committed by Ruslan Kuprieiev
parent 7a795f79db
commit 3f5757a0a5
25 changed files with 257 additions and 167 deletions
+2 -2
View File
@@ -149,7 +149,7 @@ def test_warn_on_outdated_stage(tmp_dir, dvc, local_remote, caplog):
def test_hash_recalculation(mocker, dvc, tmp_dir, local_remote):
tmp_dir.gen({"foo": "foo"})
test_file_md5 = mocker.spy(dvc_module.data.stage, "file_md5")
test_file_md5 = mocker.spy(dvc_module.objects.hash, "file_md5")
ret = main(["config", "cache.type", "hardlink"])
assert ret == 0
ret = main(["add", "foo"])
@@ -211,7 +211,7 @@ def test_verify_hashes(
remove("dir")
remove(dvc.odb.local.cache_dir)
hash_spy = mocker.spy(dvc_module.data.stage, "file_md5")
hash_spy = mocker.spy(dvc_module.objects.hash, "file_md5")
dvc.pull()
assert hash_spy.call_count == 0