mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-29 23:09:23 +01:00
dvc: include cache urls in info output. (#4848)
* dvc: include cache urls in info output. Show cache urls for external and remote cache in the info output to assist in diagnosis of issues. Fixes #4574. * Remove unnecessary constant check for generator expression. * Add remotes and caches in version command for better diagnosis. * Fix flaky unit test to be runtime independent by using regex search. * Use Cache.by_scheme() for enumerating supported caches. * Add get_cloud_schemes routine for retrieval of configured remote schemes. Add tests for local remote and remote:// scheme for info. * Cleanup unused code. * info: refactor remote parsing Co-authored-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
co-authored by
Ruslan Kuprieiev
parent
251a3269c2
commit
6324bd8a69
@@ -32,23 +32,23 @@ TREES = [
|
||||
]
|
||||
|
||||
|
||||
def _get_tree(remote_conf):
|
||||
def get_tree_cls(remote_conf):
|
||||
for tree_cls in TREES:
|
||||
if tree_cls.supported(remote_conf):
|
||||
return tree_cls
|
||||
return LocalTree
|
||||
|
||||
|
||||
def _get_conf(repo, **kwargs):
|
||||
def get_tree_config(config, **kwargs):
|
||||
name = kwargs.get("name")
|
||||
if name:
|
||||
remote_conf = repo.config["remote"][name.lower()]
|
||||
remote_conf = config["remote"][name.lower()]
|
||||
else:
|
||||
remote_conf = kwargs
|
||||
return _resolve_remote_refs(repo, remote_conf)
|
||||
return _resolve_remote_refs(config, remote_conf)
|
||||
|
||||
|
||||
def _resolve_remote_refs(repo, remote_conf):
|
||||
def _resolve_remote_refs(config, remote_conf):
|
||||
# Support for cross referenced remotes.
|
||||
# This will merge the settings, shadowing base ref with remote_conf.
|
||||
# For example, having:
|
||||
@@ -74,7 +74,7 @@ def _resolve_remote_refs(repo, remote_conf):
|
||||
if parsed.scheme != "remote":
|
||||
return remote_conf
|
||||
|
||||
base = _get_conf(repo, name=parsed.netloc)
|
||||
base = get_tree_config(config, name=parsed.netloc)
|
||||
url = posixpath.join(base["url"], parsed.path.lstrip("/"))
|
||||
return {**base, **remote_conf, "url": url}
|
||||
|
||||
@@ -82,9 +82,9 @@ def _resolve_remote_refs(repo, remote_conf):
|
||||
def get_cloud_tree(repo, **kwargs):
|
||||
from dvc.config import SCHEMA, ConfigError, Invalid
|
||||
|
||||
remote_conf = _get_conf(repo, **kwargs)
|
||||
remote_conf = get_tree_config(repo.config, **kwargs)
|
||||
try:
|
||||
remote_conf = SCHEMA["remote"][str](remote_conf)
|
||||
except Invalid as exc:
|
||||
raise ConfigError(str(exc)) from None
|
||||
return _get_tree(remote_conf)(repo, remote_conf)
|
||||
return get_tree_cls(remote_conf)(repo, remote_conf)
|
||||
|
||||
Reference in New Issue
Block a user