[ez][CI] Do not reuse old whl if deleting files (#154731)

Thankfully very few commits actually delete files so I don't think has affected anything
Pull Request resolved: https://github.com/pytorch/pytorch/pull/154731
Approved by: https://github.com/Skylion007
This commit is contained in:
Catherine Lee
2025-05-30 22:35:13 +00:00
committed by PyTorch MergeBot
parent eb93c0adb1
commit 0f3db20132

View File

@ -120,6 +120,23 @@ def ok_changed_file(file: str) -> bool:
def check_changed_files(sha: str) -> bool:
# Return true if all the changed files are in the list of allowed files to
# be changed to reuse the old whl
# Removing any files is not allowed since rysnc will not remove files
removed_files = (
subprocess.check_output(
["git", "diff", "--name-only", sha, "HEAD", "--diff-filter=D"],
text=True,
stderr=subprocess.DEVNULL,
)
.strip()
.split()
)
if removed_files:
print(
f"Removed files between {sha} and HEAD: {removed_files}, cannot reuse old whl"
)
return False
changed_files = (
subprocess.check_output(
["git", "diff", "--name-only", sha, "HEAD"],