mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
+15
-7
@@ -24,13 +24,21 @@ class ConfigError(DvcException):
|
||||
|
||||
|
||||
class NoRemoteError(ConfigError):
|
||||
def __init__(self, command):
|
||||
msg = (
|
||||
"no remote specified. Setup default remote with\n"
|
||||
" dvc remote default <name>\n"
|
||||
"or use:\n"
|
||||
" dvc {} -r <name>\n".format(command)
|
||||
)
|
||||
def __init__(self, command, *, has_any_remote=True):
|
||||
if has_any_remote:
|
||||
msg = (
|
||||
"no remote specified. Setup default remote with\n"
|
||||
" dvc remote default <remote name>\n"
|
||||
"or use:\n"
|
||||
" dvc {} -r <remote name>".format(command)
|
||||
)
|
||||
else:
|
||||
msg = (
|
||||
"no remote specified. Create a remote with\n"
|
||||
" dvc remote add <remote name> <remote url>\n"
|
||||
"To create a default remote use the -d flag:\n"
|
||||
" dvc remote add -d <remote name> <remote url>\n"
|
||||
)
|
||||
|
||||
super().__init__(msg)
|
||||
|
||||
|
||||
+3
-1
@@ -39,7 +39,9 @@ class DataCloud(object):
|
||||
if remote:
|
||||
return self._init_remote(remote)
|
||||
|
||||
raise NoRemoteError(command)
|
||||
has_any_remote = any(key.startswith("remote ") for key in self._config)
|
||||
|
||||
raise NoRemoteError(command, has_any_remote=has_any_remote)
|
||||
|
||||
def _init_remote(self, remote):
|
||||
return Remote(self.repo, name=remote)
|
||||
|
||||
Reference in New Issue
Block a user