mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-06 15:28:28 +01:00
Merge pull request #2759 from pared/2711
get/import: more meaningful message on NoRemoteError
This commit is contained in:
@@ -328,3 +328,13 @@ class CheckoutError(DvcException):
|
||||
|
||||
class CollectCacheError(DvcException):
|
||||
pass
|
||||
|
||||
|
||||
class RemoteNotSpecifiedInExternalRepoError(DvcException):
|
||||
def __init__(self, url, cause=None):
|
||||
super(RemoteNotSpecifiedInExternalRepoError, self).__init__(
|
||||
"No DVC remote is specified in the target repository '{}'".format(
|
||||
url
|
||||
),
|
||||
cause=cause,
|
||||
)
|
||||
|
||||
@@ -7,6 +7,8 @@ from distutils.dir_util import copy_tree
|
||||
|
||||
from funcy import retry
|
||||
|
||||
from dvc.config import NoRemoteError
|
||||
from dvc.exceptions import RemoteNotSpecifiedInExternalRepoError
|
||||
from dvc.utils import remove
|
||||
|
||||
|
||||
@@ -19,7 +21,10 @@ def external_repo(url=None, rev=None, rev_lock=None, cache_dir=None):
|
||||
|
||||
path = _external_repo(url=url, rev=rev_lock or rev, cache_dir=cache_dir)
|
||||
repo = Repo(path)
|
||||
yield repo
|
||||
try:
|
||||
yield repo
|
||||
except NoRemoteError as exc:
|
||||
raise RemoteNotSpecifiedInExternalRepoError(url, cause=exc)
|
||||
repo.close()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user