Skip to content
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

move: validate new stage before move #5953

Merged
merged 2 commits into from
May 5, 2021
Merged

Conversation

pmrowla
Copy link
Contributor

@pmrowla pmrowla commented May 4, 2021

Thank you for the contribution - we'll try to review it as soon as possible. πŸ™

Will close #5886

  • dvc move now uses repo.stage.create to create the new destination stage instead of just modifying the existing stage.path in order to do the necessary validation (check if dest overlaps with existing output, new .dvc file would be gitignored, etc)

@pmrowla pmrowla added the bugfix fixes bug label May 4, 2021
@pmrowla pmrowla self-assigned this May 4, 2021
@@ -330,7 +330,7 @@ def validate_state(
def validate_kwargs(single_stage: bool = False, fname: str = None, **kwargs):
"""Prepare, validate and process kwargs passed from cli"""
cmd = kwargs.get("cmd")
if not cmd:
if not cmd and not single_stage:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this should be a separate data_source kwarg instead of using single_stage? @skshetry

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still support stages in .dvc file, so it's not just about data_source. Maybe in 3.0? πŸ˜„

@pmrowla pmrowla requested a review from a team May 4, 2021 07:27
def test_move_output_overlap(tmp_dir, dvc):
from dvc.exceptions import OverlappingOutputPathsError

tmp_dir.dvc_gen({"foo": "foo", "dir": {"bar": "bar"}})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this generate dir.dvc or bar.dvc? Should this test that dir.dvc does not change (and maybe that dir/bar still exists)?

Also, should both of these tests check that the .gitignore files haven't changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This generates dir.dvc.

Regarding not making gitignore changes on failed stage creation, we check for that in other func tests, we shouldn't need to duplicate that here.

@pmrowla pmrowla merged commit 256cb06 into iterative:master May 5, 2021
@pmrowla pmrowla deleted the 5886-move branch May 5, 2021 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix fixes bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

move: creates inconsistency when moving tracked file into tracked folder
3 participants