-
Notifications
You must be signed in to change notification settings - Fork 1.2k
dvc: add checkout --relink #2922
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
88370e1
dvc: reorganize imports in dvc.remote.base
Suor 3b2666e
remote: remove unused exception class
Suor 2f79e36
dvc: add checkout --relink
Suor 3610961
dvc: warn to run `dvc checkout --relink` in cache.type change
Suor 1143a8c
test: add checkout parse-cli-api test
Suor 5d1f01d
checkout: iron out --relink related messages
Suor da49bad
Merge branch 'master' into relink
efiop File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,14 @@ def run(self): | |
| section, opt, self.args.value, level=self.args.level | ||
| ) | ||
|
|
||
| is_write = self.args.unset or self.args.value is not None | ||
| if is_write and self.args.name == "cache.type": | ||
| logger.warning( | ||
| "You have changed the 'cache.type' option. This doesn't update" | ||
| " any existing workspace file links, but it can be done with:" | ||
| "\n dvc checkout --relink" | ||
|
Comment on lines
+36
to
+37
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.
Also, I would've put the |
||
| ) | ||
|
|
||
| return 0 | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| from dvc.cli import parse_args | ||
| from dvc.command.checkout import CmdCheckout | ||
|
|
||
|
|
||
| def test_checkout(tmp_dir, dvc, mocker): | ||
| cli_args = parse_args( | ||
| ["checkout", "foo.dvc", "bar.dvc", "--relink", "--with-deps"] | ||
| ) | ||
| assert cli_args.func == CmdCheckout | ||
|
|
||
| cmd = cli_args.func(cli_args) | ||
| m = mocker.patch("dvc.repo.Repo.checkout") | ||
|
|
||
| assert cmd.run() == 0 | ||
| m.assert_called_once_with( | ||
| targets=["foo.dvc", "bar.dvc"], | ||
| force=False, | ||
| recursive=False, | ||
| relink=True, | ||
| with_deps=True, | ||
| ) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.