We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b13c174 commit 8dc6587Copy full SHA for 8dc6587
1 file changed
scripts/hatch_build.py
@@ -126,12 +126,12 @@ def yaml_dump(o: Any, **kwargs: Any) -> str:
126
for file, old, new in patches:
127
file_path = pathlib.Path(file)
128
file_content = file_path.read_text()
129
- if file_content != new and file_content != old:
+ if new not in file_content and old not in file_content:
130
raise RuntimeError(
131
f"Unexpected content in {file_path}. Did you update pre-commit without updating the patches?"
132
)
133
- if file_content == old:
134
- file_path.write_text(new)
+ if old in file_content:
+ file_path.write_text(file_content.replace(old, new))
135
136
if not (pathlib.Path(self.root) / "scripts").exists():
137
return
0 commit comments