-
Notifications
You must be signed in to change notification settings - Fork 1.2k
repo: Add ignore_revs
.
#8098
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
repo: Add ignore_revs
.
#8098
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -384,6 +384,7 @@ def _ignore(self): | |
def brancher(self, *args, **kwargs): | ||
from dvc.repo.brancher import brancher | ||
|
||
kwargs["ignore_revs"] = self.ignore_revs | ||
return brancher(self, *args, **kwargs) | ||
|
||
def used_objs( | ||
|
@@ -489,6 +490,19 @@ def partial_imports( | |
def stages(self): # obsolete, only for backward-compatibility | ||
return self.index.stages | ||
|
||
@property | ||
def ignore_revs_file(self): | ||
if self.dvc_dir: | ||
return self.fs.path.join(self.dvc_dir, "ignore_revs") | ||
|
||
@property | ||
def ignore_revs(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should clarify what is Also what should happen if user asks for that particular revision (eg: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Not sure I follow. Could you elaborate the use case?
I believe we should read from the current revision. Treat
We will skip the revision. |
||
if self.ignore_revs_file is not None: | ||
if self.fs.exists(self.ignore_revs_file): | ||
with self.fs.open(self.ignore_revs_file) as f: | ||
return set(f.read().strip().splitlines()) | ||
return set() | ||
|
||
def find_outs_by_path(self, path, outs=None, recursive=False, strict=True): | ||
# using `outs_graph` to ensure graph checks are run | ||
outs = outs or self.index.outs_graph | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,6 +252,20 @@ def run( | |
return run | ||
|
||
|
||
@pytest.fixture | ||
def broken_rev(tmp_dir, scm, dvc): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need a broken rev and the whole functional test. Instead, just check that if the config file made the desired revision disappear from iter_revs with a unit test is enough. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think it's not enough in this case. |
||
tmp_dir.gen("params.yaml", "foo: 1") | ||
dvc.run(cmd="echo ${foo}", name="foo") | ||
|
||
scm.add(["dvc.yaml", "dvc.lock"]) | ||
scm.commit("init broken") | ||
_broken_rev = scm.get_rev() | ||
|
||
scm.add(["params.yaml"]) | ||
scm.commit("fixed") | ||
return _broken_rev | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def mock_hydra_conf(mocker): | ||
if sys.version_info < (3, 11): | ||
|
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.
How about