-
Notifications
You must be signed in to change notification settings - Fork 1.3k
dvc.scm: refactor exceptions #7017
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
Conversation
dvc/scm/__init__.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR specifically, but we will probably need a dvc.utils.resolve_rev function that wraps the separate SCM package's resolve_rev.
The existing scm.git.resolve_rev method contains DVC specific behavior, where we extend the standard git ref (branch/tag) resolution to also include refs in the exps namespace. This should probably stay in DVC (and not the standalone package).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pmrowla, this dvc/scm/__init__.py will remain as dvc/scm.py. So, this resolve_rev is the one that will provide DVC specific behaviour. The following contents will be moved here in successive PRs:
d18aa9b to
b7634bd
Compare
|
The new changes remaps internal |
This PR splits scm-related exceptions into two kinds:
dvc.scm.exceptionsand likely going to be available asscmrepo.exceptions.dvc.scm.basethat is required for UI and dvc's API to work.This will be available in
dvc.scmwhen we migrate.So, due to 2, there are some exceptions with the same name in both 1 and 2, but they serve a different purpose and are just reraised from one to another.
This PR is still incomplete, in that we have to decide what to do with raised
SCMErrorexceptions. As DVC is unaware of these exceptions, places where we are checking forDvcExceptionor where we just exit from themain, it will throw errors with:There may definitely be some UI issues with this breakage, which we need to discuss. The easiest path forward that I see is to make these changes and fix them in the future as we find them.
The other way would require us to go through chains of API calls where we raise
dvc.scm.exceptions.SCMErrorand catch those and reraise those asdvc.scm.base.SCMError.