diff --git a/dvc/scm.py b/dvc/scm.py index de68cd44b..30e05ec73 100644 --- a/dvc/scm.py +++ b/dvc/scm.py @@ -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 diff --git a/tests/unit/scm/test_scm.py b/tests/unit/scm/test_scm.py index 30b7c017a..2820d406a 100644 --- a/tests/unit/scm/test_scm.py +++ b/tests/unit/scm/test_scm.py @@ -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)