Implement the main logic
This commit is contained in:
parent
0aee4d44a5
commit
28e5f45598
1 changed files with 3 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -18,7 +19,8 @@ def should_include_change(change_lines: list[str], search: str, replace: str) ->
|
||||||
added_lines.append(line[1:])
|
added_lines.append(line[1:])
|
||||||
continue
|
continue
|
||||||
raise ValueError("Unexpected non-change line in change block.")
|
raise ValueError("Unexpected non-change line in change block.")
|
||||||
return True
|
transformed_removed = [re.sub(search, replace, line) for line in removed_lines]
|
||||||
|
return transformed_removed == added_lines
|
||||||
|
|
||||||
|
|
||||||
def should_include_hunk(hunk_text: str, search: str, replace: str) -> bool:
|
def should_include_hunk(hunk_text: str, search: str, replace: str) -> bool:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue