mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
exceptions: migrate other scm exceptions to internal
This commit is contained in:
committed by
Ruslan Kuprieiev
parent
f2f4227656
commit
f76ef84c88
@@ -46,7 +46,12 @@ def apply(repo, rev, force=True, **kwargs):
|
||||
else:
|
||||
workspace = None
|
||||
|
||||
repo.scm.merge(exp_rev, commit=False)
|
||||
from dvc.scm.exceptions import SCMError as _SCMError
|
||||
|
||||
try:
|
||||
repo.scm.merge(exp_rev, commit=False)
|
||||
except _SCMError as exc:
|
||||
raise SCMError(str(exc))
|
||||
|
||||
if workspace:
|
||||
try:
|
||||
@@ -61,7 +66,7 @@ def apply(repo, rev, force=True, **kwargs):
|
||||
repo.scm.reset(hard=True)
|
||||
repo.scm.stash.pop()
|
||||
raise ApplyConflictError(rev) from exc
|
||||
except SCMError as exc:
|
||||
except _SCMError as exc:
|
||||
raise ApplyConflictError(rev) from exc
|
||||
repo.scm.stash.drop()
|
||||
repo.scm.reset()
|
||||
|
||||
+10
-4
@@ -26,11 +26,17 @@ def SCM(
|
||||
Returns:
|
||||
dvc.scm.base.Base: SCM instance.
|
||||
"""
|
||||
from dvc.scm.base import SCMError
|
||||
from dvc.scm.exceptions import SCMError as InternalSCMError
|
||||
|
||||
if no_scm:
|
||||
return NoSCM(root_dir)
|
||||
|
||||
return Git(root_dir, search_parent_directories=search_parent_directories)
|
||||
try:
|
||||
if no_scm:
|
||||
return NoSCM(root_dir)
|
||||
return Git(
|
||||
root_dir, search_parent_directories=search_parent_directories
|
||||
)
|
||||
except InternalSCMError as exc:
|
||||
raise SCMError(str(exc))
|
||||
|
||||
|
||||
def clone(url: str, to_path: str, **kwargs):
|
||||
|
||||
@@ -10,7 +10,7 @@ from typing import (
|
||||
Union,
|
||||
)
|
||||
|
||||
from dvc.scm.base import SCMError
|
||||
from dvc.scm.exceptions import SCMError
|
||||
|
||||
from ..objects import GitObject
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ from typing import (
|
||||
from funcy import cached_property
|
||||
|
||||
from dvc.progress import Tqdm
|
||||
from dvc.scm.base import SCMError
|
||||
from dvc.scm.exceptions import AuthError, InvalidRemote
|
||||
from dvc.scm.exceptions import AuthError, InvalidRemote, SCMError
|
||||
from dvc.utils import relpath
|
||||
|
||||
from ...objects import GitObject
|
||||
|
||||
@@ -17,8 +17,12 @@ from typing import (
|
||||
from funcy import ignore
|
||||
|
||||
from dvc.progress import Tqdm
|
||||
from dvc.scm.base import SCMError
|
||||
from dvc.scm.exceptions import CloneError, MergeConflictError, RevError
|
||||
from dvc.scm.exceptions import (
|
||||
CloneError,
|
||||
MergeConflictError,
|
||||
RevError,
|
||||
SCMError,
|
||||
)
|
||||
from dvc.utils import fix_env, is_binary, relpath
|
||||
|
||||
from ..objects import GitCommit, GitObject
|
||||
|
||||
@@ -17,8 +17,7 @@ from typing import (
|
||||
|
||||
from funcy import cached_property
|
||||
|
||||
from dvc.scm.base import SCMError
|
||||
from dvc.scm.exceptions import MergeConflictError, RevError
|
||||
from dvc.scm.exceptions import MergeConflictError, RevError, SCMError
|
||||
from dvc.utils import relpath
|
||||
|
||||
from ..objects import GitCommit, GitObject
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from dvc.scm.base import SCMError
|
||||
from dvc.scm.exceptions import SCMError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import os
|
||||
|
||||
import pytest
|
||||
|
||||
from dvc.scm.base import SCMError
|
||||
from dvc.scm.exceptions import SCMError
|
||||
|
||||
|
||||
# Behaves the same as SCM but will test against all supported Git backends.
|
||||
|
||||
Reference in New Issue
Block a user