diff --git a/dvc/scm/base.py b/dvc/scm/base.py index e35c7b7d7..bbad771a0 100644 --- a/dvc/scm/base.py +++ b/dvc/scm/base.py @@ -27,10 +27,7 @@ class CloneError(SCMError): class RevError(SCMError): - def __init__(self, url, rev): - super().__init__( - "failed to access revision '{}' for repo '{}'".format(rev, url) - ) + pass class Base(object): diff --git a/dvc/scm/git/__init__.py b/dvc/scm/git/__init__.py index 8efb2dc5d..9ae9e1514 100644 --- a/dvc/scm/git/__init__.py +++ b/dvc/scm/git/__init__.py @@ -94,7 +94,11 @@ class Git(Base): try: repo.checkout(rev) except git.exc.GitCommandError as exc: - raise RevError(url, rev) from exc + raise RevError( + "failed to access revision '{}' for repo '{}'".format( + rev, url + ) + ) from exc return repo @@ -367,8 +371,8 @@ class Git(Base): try: return self.repo.git.rev_parse(rev) - except GitCommandError as exc: - raise RevError(url=self.root_dir, rev=rev) from exc + except GitCommandError: + raise RevError("unknown Git revision '{}'".format(rev)) def close(self): self.repo.close() diff --git a/tests/func/test_diff.py b/tests/func/test_diff.py index da1307fd2..1ffb1c699 100644 --- a/tests/func/test_diff.py +++ b/tests/func/test_diff.py @@ -107,9 +107,7 @@ def test_refs(tmp_dir, scm, dvc): ], } - with pytest.raises( - DvcException, match=r"failed to access revision 'missing'" - ): + with pytest.raises(DvcException, match=r"unknown Git revision 'missing'"): dvc.diff("missing")