-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Build: replace GitPython with git commands #10594
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 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ba7f986
Build: replace GitPython with git commands
stsewd 77d3681
Cleanup
stsewd 5ecfcc2
Fix tests
stsewd 39bf8b6
Black
stsewd b724f5b
Format
stsewd d8a3607
Test
stsewd a6e7f01
Updates from review
stsewd 475874b
Merge branch 'main' into replace-gitpython
stsewd 5f14e95
Black
stsewd 60b637a
Merge branch 'main' into replace-gitpython
stsewd 848f2be
Apply suggestions from code review
humitos 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 |
---|---|---|
|
@@ -328,12 +328,14 @@ def test_invalid_submodule_is_ignored(self): | |
repo.checkout('submodule') | ||
gitmodules_path = os.path.join(repo.working_dir, '.gitmodules') | ||
|
||
with open(gitmodules_path, 'a') as f: | ||
content = textwrap.dedent(""" | ||
with open(gitmodules_path, "a") as f: | ||
content = textwrap.dedent( | ||
""" | ||
[submodule "not-valid-path"] | ||
path = not-valid-path | ||
url = https://github.com/readthedocs/readthedocs.org | ||
""") | ||
url = | ||
""" | ||
) | ||
f.write(content) | ||
|
||
valid, submodules = repo.validate_submodules(self.dummy_conf) | ||
|
@@ -492,15 +494,61 @@ def test_invalid_submodule_is_ignored(self): | |
""" | ||
[submodule "not-valid-path"] | ||
path = not-valid-path | ||
url = https://github.com/readthedocs/readthedocs.org | ||
""" | ||
url = | ||
""" | ||
) | ||
f.write(content) | ||
|
||
valid, submodules = repo.validate_submodules(self.dummy_conf) | ||
self.assertTrue(valid) | ||
self.assertEqual(list(submodules), ["foobar"]) | ||
|
||
def test_parse_submodules(self): | ||
repo = self.project.vcs_repo( | ||
environment=self.build_environment, | ||
version_type=BRANCH, | ||
version_identifier="submodule", | ||
) | ||
repo.update() | ||
repo.checkout("submodule") | ||
gitmodules_path = os.path.join(repo.working_dir, ".gitmodules") | ||
|
||
with open(gitmodules_path, "a") as f: | ||
content = textwrap.dedent( | ||
""" | ||
[submodule "not-valid-path"] | ||
path = not-valid-path | ||
url = | ||
|
||
[submodule "path with spaces"] | ||
path = path with spaces | ||
url = https://github.com | ||
|
||
[submodule "another-submodule"] | ||
url = https://github.com | ||
path = another-submodule | ||
|
||
[ssubmodule "invalid-submodule-key"] | ||
url = https://github.com | ||
path = invalid-submodule-key | ||
|
||
[submodule "invalid-path-key"] | ||
url = https://github.com | ||
paths = invalid-submodule-key | ||
|
||
[submodule "invalid-url-key"] | ||
uurl = https://github.com | ||
path = invalid-submodule-key | ||
""" | ||
) | ||
f.write(content) | ||
|
||
valid, submodules = repo.validate_submodules(self.dummy_conf) | ||
self.assertTrue(valid) | ||
self.assertEqual( | ||
list(submodules), ["foobar", "path with spaces", "another-submodule"] | ||
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. Where does the 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. It's defined in the |
||
) | ||
|
||
def test_skip_submodule_checkout(self): | ||
"""Test that a submodule is listed as available.""" | ||
repo = self.project.vcs_repo( | ||
|
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
Oops, something went wrong.
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.
It would be good to do
log.warning
here, so we can easily realize if there is a problem from NR.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.
I can add a log here, but we will probably see a spike in logs, since we weren't logging these before.
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.
Do you think we have lot of command's outputs that are not possible to decode? That shouldn't be normal, I'd say.