fix(scripts): normalize jj and hg added paths on Windows - #7046
Open
claxman wants to merge 1 commit into
Open
Conversation
get_vcs_added_files joined jj and hg roots with os.path.join and never called .replace(os.sep, '/'). Parametrized jj/hg tests that patch os.path to ntpath and os.sep to \\ fail on b018062 with {'/workspace\\src/google/adk/agents/_jj_agent.py'} and the hg equivalent. Add .replace(os.sep, '/') on those two backends, matching find_py_files. Verification: test_check_new_py_files.py 31 passed. Base script fails jj[True] and hg[True]. Fixes google#7029
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
Problem:
get_vcs_added_filesjoins jj and hg roots withos.path.joinand never calls.replace(os.sep, '/'). A snippet mockedos.pathtontpathandos.septo\\, then calledget_vcs_added_files('.')with a fakejj diff --summaryofA src/google/adk/agents/_jj_agent.py. Without the replace, the set is{'/workspace\\src/google/adk/agents/_jj_agent.py'}.Solution:
Normalize the jj and hg joined paths with
.replace(os.sep, '/'), matchingfind_py_files. git, g4, and p4 are unchanged.Testing Plan
Unit Tests:
31 passed.
With
scripts/check_new_py_files.pychecked out fromb0180620,test_get_vcs_added_files_jj[True]andtest_get_vcs_added_files_hg[True]fail. They compare{'/workspace\\src/google/adk/agents/_jj_agent.py'}and{'/workspace\\src/google/adk/agents/_hg_agent.py'}to the forward-slash expected set. The posix cases ([False]) still pass.Manual End-to-End (E2E) Tests:
Not run. No Windows host and no live jj or hg checkout.
Additional context
Claim: #7029 (comment)
Checklist