mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 07:18:27 +01:00
import-url: compute the stage hash in --to-remote (#6175)
* import-url: compute the stage hash in --to-remote * save_deps() before calculating the md5
This commit is contained in:
@@ -76,6 +76,8 @@ def imp_url(
|
||||
elif to_remote:
|
||||
remote = self.cloud.get_remote(remote, "import-url")
|
||||
stage.outs[0].transfer(url, odb=remote.odb, jobs=jobs)
|
||||
stage.save_deps()
|
||||
stage.md5 = stage.compute_md5()
|
||||
else:
|
||||
stage.run(jobs=jobs)
|
||||
|
||||
|
||||
@@ -274,6 +274,7 @@ def test_import_url_to_remote_single_file(
|
||||
url = "remote://workspace/foo"
|
||||
stage = dvc.imp_url(url, to_remote=True)
|
||||
|
||||
assert stage.deps[0].hash_info.value is not None
|
||||
assert not (tmp_dir / "foo").exists()
|
||||
assert (tmp_dir / "foo.dvc").exists()
|
||||
|
||||
@@ -400,3 +401,18 @@ def test_import_url_empty_directory(tmp_dir, dvc, workspace):
|
||||
empty_dir = tmp_dir / "empty_dir"
|
||||
assert empty_dir.is_dir()
|
||||
assert tuple(empty_dir.iterdir()) == ()
|
||||
|
||||
|
||||
def test_import_url_to_remote_status(tmp_dir, dvc, local_cloud, local_remote):
|
||||
local_cloud.gen("foo", "foo")
|
||||
|
||||
stage = dvc.imp_url(str(local_cloud / "foo"), to_remote=True)
|
||||
assert stage.md5 is not None
|
||||
|
||||
status = dvc.status()
|
||||
assert status["foo.dvc"] == [{"changed outs": {"foo": "not in cache"}}]
|
||||
|
||||
dvc.pull()
|
||||
|
||||
status = dvc.status()
|
||||
assert len(status) == 0
|
||||
|
||||
Reference in New Issue
Block a user