mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-12 07:18:23 +01:00
api: enter state when trying to get a hash (#4584)
`get_hash` is an internal api, so conventions should be respected. Fixes #4575
This commit is contained in:
+2
-1
@@ -34,7 +34,8 @@ def get_url(path, repo=None, rev=None, remote=None):
|
||||
raise OutputNotFoundError(path, repo)
|
||||
|
||||
cloud = metadata.repo.cloud
|
||||
hash_info = _repo.repo_tree.get_hash(path_info)
|
||||
with _repo.state:
|
||||
hash_info = _repo.repo_tree.get_hash(path_info)
|
||||
return cloud.get_url_for(remote, checksum=hash_info.value)
|
||||
|
||||
|
||||
|
||||
@@ -210,6 +210,9 @@ def test_get_url_granular(tmp_dir, dvc, s3):
|
||||
{"dir": {"foo": "foo", "bar": "bar", "nested": {"file": "file"}}}
|
||||
)
|
||||
|
||||
expected_url = URLInfo(s3.url) / "5f/c28ea78987408341668eba6525ebd1.dir"
|
||||
assert api.get_url("dir") == expected_url
|
||||
|
||||
expected_url = URLInfo(s3.url) / "ac/bd18db4cc2f85cedef654fccc4a4d8"
|
||||
assert api.get_url("dir/foo") == expected_url
|
||||
|
||||
|
||||
Reference in New Issue
Block a user