Skip to content

Commit 8dc6587

Browse files
committed
do old and new
1 parent b13c174 commit 8dc6587

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

scripts/hatch_build.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ def yaml_dump(o: Any, **kwargs: Any) -> str:
126126
for file, old, new in patches:
127127
file_path = pathlib.Path(file)
128128
file_content = file_path.read_text()
129-
if file_content != new and file_content != old:
129+
if new not in file_content and old not in file_content:
130130
raise RuntimeError(
131131
f"Unexpected content in {file_path}. Did you update pre-commit without updating the patches?"
132132
)
133-
if file_content == old:
134-
file_path.write_text(new)
133+
if old in file_content:
134+
file_path.write_text(file_content.replace(old, new))
135135

136136
if not (pathlib.Path(self.root) / "scripts").exists():
137137
return

0 commit comments

Comments
 (0)