output: save: error out on cached external outputs (#9672)

* output: save: error out on cached external outputs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Ruslan Kuprieiev
2023-06-29 13:05:17 +03:00
committed by GitHub
co-authored by pre-commit-ci[bot]
parent c90947f33c
commit 910c232077
+9
View File
@@ -20,6 +20,7 @@ from dvc.exceptions import (
DvcException,
MergeError,
)
from dvc.utils import format_link
from dvc.utils.objects import cached_property
from dvc_data.hashfile import check as ocheck
from dvc_data.hashfile import load as oload
@@ -678,6 +679,14 @@ class Output:
# pylint: enable=no-member
def save(self) -> None:
if self.use_cache and not self.is_in_repo:
raise DvcException(
f"Saving cached external output {str(self)} is not supported "
"since DVC 3.0. See "
f"{format_link('https://dvc.org/doc/user-guide/upgrade')} "
"for more info."
)
if not self.exists:
raise self.DoesNotExistError(self)