-
Notifications
You must be signed in to change notification settings - Fork 1.3k
update: handle imported files from non-DVC git repositories #3172
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
Closed
fabiosantoscode
wants to merge
6
commits into
treeverse:master
from
fabiosantoscode:feature/2976-update-git-tracked-imported-files
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8cfdbed
update: handle git-tracked imported files
fabiosantoscode 0647536
Merge remote-tracking branch 'upstream/master' into feature/2976-upda…
fabiosantoscode a174a60
simplify test
fabiosantoscode 7376698
create git_repo fixture
fabiosantoscode 8bb2815
simplify tests using new fixture
fabiosantoscode 89e7aba
rename fixture
fabiosantoscode 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
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -61,27 +61,25 @@ def test_status_non_dvc_repo_import(tmp_dir, dvc, erepo_dir): | |||||
| } | ||||||
|
|
||||||
|
|
||||||
| def test_status_before_and_after_dvc_init(tmp_dir, dvc, erepo_dir): | ||||||
| with erepo_dir.chdir(): | ||||||
| erepo_dir.scm.repo.index.remove([".dvc"], r=True) | ||||||
| shutil.rmtree(".dvc") | ||||||
| erepo_dir.scm_gen("file", "first version") | ||||||
| erepo_dir.scm.add(["file"]) | ||||||
| erepo_dir.scm.commit("first version") | ||||||
| old_rev = erepo_dir.scm.get_rev() | ||||||
| def test_status_before_and_after_dvc_init(tmp_dir, dvc, external_git_dir): | ||||||
| with external_git_dir.chdir(): | ||||||
| external_git_dir.scm_gen( | ||||||
| "file", "first version", commit="first version" | ||||||
| ) | ||||||
| old_rev = external_git_dir.scm.get_rev() | ||||||
|
|
||||||
| dvc.imp(fspath(erepo_dir), "file", "file") | ||||||
| dvc.imp(fspath(external_git_dir), "file", "file") | ||||||
|
|
||||||
| assert dvc.status(["file.dvc"]) == {} | ||||||
|
|
||||||
| with erepo_dir.chdir(): | ||||||
| Repo.init() | ||||||
| erepo_dir.scm.repo.index.remove(["file"]) | ||||||
| with external_git_dir.chdir(): | ||||||
| external_git_dir.dvc = Repo.init() | ||||||
| external_git_dir.scm.repo.index.remove(["file"]) | ||||||
| os.remove("file") | ||||||
| erepo_dir.dvc_gen("file", "second version") | ||||||
| erepo_dir.scm.add([".dvc", "file.dvc"]) | ||||||
| erepo_dir.scm.commit("version with dvc") | ||||||
| new_rev = erepo_dir.scm.get_rev() | ||||||
| external_git_dir.dvc_gen("file", "second version") | ||||||
|
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. Adding the
Suggested change
|
||||||
| external_git_dir.scm.add([".dvc", "file.dvc"]) | ||||||
| external_git_dir.scm.commit("version with dvc") | ||||||
| new_rev = external_git_dir.scm.get_rev() | ||||||
|
|
||||||
| assert old_rev != new_rev | ||||||
|
|
||||||
|
|
@@ -93,6 +91,6 @@ def test_status_before_and_after_dvc_init(tmp_dir, dvc, erepo_dir): | |||||
|
|
||||||
| assert status == { | ||||||
| "changed deps": { | ||||||
| "file ({})".format(fspath(erepo_dir)): "update available" | ||||||
| "file ({})".format(fspath(external_git_dir)): "update available" | ||||||
| } | ||||||
| } | ||||||
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
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.
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.
Making a new fixture for a single test is an overkill, doing some copy-paste inside is even worse. You may simply use
erepo_dirand remove.dvcdir there.