Introduce should_include_change
This commit is contained in:
parent
d7637d1cec
commit
4715d9d858
1 changed files with 23 additions and 0 deletions
|
|
@ -3,7 +3,30 @@
|
|||
import sys
|
||||
|
||||
|
||||
def should_include_change(change_lines: list[str], search: str, replace: str) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def should_include_hunk(hunk_text: str, search: str, replace: str) -> bool:
|
||||
lines = hunk_text.splitlines()
|
||||
if not lines:
|
||||
return True
|
||||
|
||||
change = []
|
||||
for line in lines[1:]:
|
||||
if line.startswith(("+", "-")):
|
||||
change.append(line)
|
||||
continue
|
||||
|
||||
if change:
|
||||
if not should_include_change(change, search, replace):
|
||||
return False
|
||||
change = []
|
||||
|
||||
if change:
|
||||
if not should_include_change(change, search, replace):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue