scm: Remove unused GitMergeError.

Not used after https://github.com/iterative/dvc/pull/9096
This commit is contained in:
David de la Iglesia Castro
2023-03-03 18:09:57 +01:00
parent baeecd1972
commit e4d514c990
2 changed files with 1 additions and 29 deletions
-20
View File
@@ -20,7 +20,6 @@ from scmrepo.noscm import NoSCM
from dvc.exceptions import DvcException
from dvc.progress import Tqdm
from dvc.utils import format_link
if TYPE_CHECKING:
from scmrepo.progress import GitProgressEvent
@@ -58,25 +57,6 @@ class GitAuthError(SCMError):
super().__init__(f"{reason}\n{doc}")
class GitMergeError(SCMError):
def __init__(self, msg: str, scm: Optional["Git"] = None) -> None:
if scm and self._is_shallow(scm):
url = format_link(
"https://dvc.org/doc/user-guide/troubleshooting#git-shallow"
)
msg = (
f"{msg}: `dvc exp` does not work in shallow Git repos. "
f"See {url} for more information."
)
super().__init__(msg)
@staticmethod
def _is_shallow(scm: "Git") -> bool:
if os.path.exists(os.path.join(scm.root_dir, Git.GIT_DIR, "shallow")):
return True
return False
@contextmanager
def map_scm_exception(with_cause: bool = False) -> Iterator[None]:
from scmrepo.exceptions import SCMError as InternalSCMError
+1 -9
View File
@@ -3,7 +3,7 @@ from datetime import datetime
from scmrepo.exceptions import SCMError
from dvc.repo.experiments import ExpRefInfo
from dvc.scm import GitMergeError, iter_revs
from dvc.scm import iter_revs
def test_iter_revs(
@@ -99,11 +99,3 @@ def test_iter_revs(
rev_old: [rev_old],
rev_other: [rev_other],
}
def test_merge_error(tmp_dir, scm):
exc = GitMergeError("Merge failed")
assert "shallow" not in str(exc)
tmp_dir.gen({".git": {"shallow": ""}})
exc = GitMergeError("Merge failed", scm=scm)
assert "shallow" in str(exc)