mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
update: forbid updating repo-imports with --to-remote (#5475)
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
import logging
|
||||
|
||||
from dvc.exceptions import InvalidArgumentError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _update_import_on_remote(stage, remote, jobs):
|
||||
if stage.is_repo_import:
|
||||
raise InvalidArgumentError(
|
||||
"Can't update a repo import with --to-remote"
|
||||
)
|
||||
|
||||
url = stage.deps[0].path_info.url
|
||||
stage.outs[0].hash_info = stage.repo.cloud.transfer(
|
||||
url, jobs=jobs, remote=remote, command="update"
|
||||
|
||||
@@ -3,6 +3,7 @@ import os
|
||||
import pytest
|
||||
|
||||
from dvc.dvcfile import Dvcfile
|
||||
from dvc.exceptions import InvalidArgumentError
|
||||
from tests.unit.fs.test_repo import make_subrepo
|
||||
|
||||
|
||||
@@ -317,6 +318,14 @@ def test_update_from_subrepos(tmp_dir, dvc, erepo_dir, is_dvc):
|
||||
}
|
||||
|
||||
|
||||
def test_update_import_to_remote(tmp_dir, dvc, erepo_dir, local_remote):
|
||||
erepo_dir.scm_gen({"foo": "foo"}, commit="add foo")
|
||||
stage = dvc.imp(os.fspath(erepo_dir), "foo")
|
||||
erepo_dir.scm_gen({"foo": "bar"}, commit="update foo")
|
||||
with pytest.raises(InvalidArgumentError):
|
||||
dvc.update(stage.path, to_remote=True)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"workspace",
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user