Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle get/import: more meaningful message on NoRemoteError #2781

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions dvc/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,12 @@ def __init__(self, target_infos):

class CollectCacheError(DvcException):
pass


class RemoteNotSpecifiedInExternalRepoError(DvcException):
def __init__(self, url):
super(RemoteNotSpecifiedInExternalRepoError, self).__init__(
"No DVC remote is specified in the target repository '{}'".format(
url
)
)
7 changes: 6 additions & 1 deletion dvc/external_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from funcy import retry

from dvc.config import NoRemoteError
from dvc.exceptions import RemoteNotSpecifiedInExternalRepoError
from dvc.utils import remove


Expand All @@ -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:
raise RemoteNotSpecifiedInExternalRepoError(url)
repo.close()


Expand Down