mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
data_cloud: move version_aware config check to get_remote
This commit is contained in:
committed by
Peter Rowlands (변기호)
parent
b060cadbf1
commit
b2c1c4dccd
+10
-8
@@ -25,14 +25,6 @@ class Remote:
|
|||||||
|
|
||||||
self.worktree: bool = config.pop("worktree", False)
|
self.worktree: bool = config.pop("worktree", False)
|
||||||
self.config = config
|
self.config = config
|
||||||
if self.worktree:
|
|
||||||
version_aware = self.config.get("version_aware")
|
|
||||||
if version_aware is False:
|
|
||||||
raise RemoteConfigError(
|
|
||||||
"worktree remotes require version_aware cloud"
|
|
||||||
)
|
|
||||||
if version_aware is None:
|
|
||||||
self.fs.version_aware = True
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def odb(self) -> "HashFileDB":
|
def odb(self) -> "HashFileDB":
|
||||||
@@ -71,6 +63,16 @@ class DataCloud:
|
|||||||
from dvc.fs import get_cloud_fs
|
from dvc.fs import get_cloud_fs
|
||||||
|
|
||||||
cls, config, fs_path = get_cloud_fs(self.repo, name=name)
|
cls, config, fs_path = get_cloud_fs(self.repo, name=name)
|
||||||
|
|
||||||
|
if config.get("worktree"):
|
||||||
|
version_aware = config.get("version_aware")
|
||||||
|
if version_aware is False:
|
||||||
|
raise RemoteConfigError(
|
||||||
|
"worktree remotes require version_aware cloud"
|
||||||
|
)
|
||||||
|
if version_aware is None:
|
||||||
|
config["version_aware"] = True
|
||||||
|
|
||||||
fs = cls(**config)
|
fs = cls(**config)
|
||||||
config["tmp_dir"] = self.repo.index_db_dir
|
config["tmp_dir"] = self.repo.index_db_dir
|
||||||
return Remote(name, fs_path, fs, **config)
|
return Remote(name, fs_path, fs, **config)
|
||||||
|
|||||||
Reference in New Issue
Block a user