Fixed changed detection

Failed after extracting check_line function
master
Felix Stupp 4 years ago
parent 9f1c7ede12
commit 0f24a564ae
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -125,11 +125,9 @@ def check_line(line, mapping):
else: else:
new_line = old_pattern.sub(new_url, line) new_line = old_pattern.sub(new_url, line)
verb(f"-> {new_line} # {new_url}{old_suffix}", add=-3) verb(f"-> {new_line} # {new_url}{old_suffix}", add=-3)
line = new_line return new_line
break verb(f"= {line}", add=-2)
else: return None
verb(f"= {line}", add=-2)
return line
def checkFile(source_file, mapping): def checkFile(source_file, mapping):
global write_mode global write_mode
@ -145,7 +143,10 @@ def checkFile(source_file, mapping):
for line in f: for line in f:
line = line[:-1] # Remove newline character line = line[:-1] # Remove newline character
if isDebLine(line): if isDebLine(line):
line = check_line(line, mapping) new_line = check_line(line, mapping)
if new_line:
changed = True
line = new_line
if write_mode: if write_mode:
newFile.write(line + "\n") newFile.write(line + "\n")
if write_mode and changed: if write_mode and changed:

Loading…
Cancel
Save