try patching any of the other files in the chat

This commit is contained in:
Paul Gauthier 2024-05-11 10:33:46 -07:00
parent 5ec441dd2c
commit 785259b59c

View file

@ -30,9 +30,17 @@ class EditBlockCoder(Coder):
path, original, updated = edit
full_path = self.abs_root_path(path)
content = self.io.read_text(full_path)
content = do_replace(full_path, content, original, updated, self.fence)
if content:
self.io.write_text(full_path, content)
new_content = do_replace(full_path, content, original, updated, self.fence)
if not new_content:
# try patching any of the other files in the chat
for full_path in self.abs_fnames:
content = self.io.read_text(full_path)
new_content = do_replace(full_path, content, original, updated, self.fence)
if new_content:
break
if new_content:
self.io.write_text(full_path, new_content)
passed.append(edit)
else:
failed.append(edit)