mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 22:34:59 +00:00
rely on io.dry_run
This commit is contained in:
parent
4ee5c49a04
commit
85c3bb8f12
4 changed files with 8 additions and 12 deletions
|
@ -923,7 +923,7 @@ class Coder:
|
|||
full_path = os.path.abspath(os.path.join(self.root, path))
|
||||
|
||||
if full_path in self.abs_fnames:
|
||||
if not self.dry_run and write_content:
|
||||
if write_content:
|
||||
self.io.write_text(full_path, write_content)
|
||||
return full_path
|
||||
|
||||
|
@ -949,7 +949,7 @@ class Coder:
|
|||
if not self.dry_run:
|
||||
self.repo.git.add(full_path)
|
||||
|
||||
if not self.dry_run and write_content:
|
||||
if write_content:
|
||||
self.io.write_text(full_path, write_content)
|
||||
|
||||
return full_path
|
||||
|
|
|
@ -29,8 +29,7 @@ class EditBlockCoder(Coder):
|
|||
content = self.io.read_text(full_path)
|
||||
content = do_replace(full_path, content, original, updated)
|
||||
if content:
|
||||
if not self.dry_run:
|
||||
self.io.write_text(full_path, content)
|
||||
self.io.write_text(full_path, content)
|
||||
edited.add(path)
|
||||
continue
|
||||
self.io.tool_error(f"Failed to apply edit to {path}")
|
||||
|
|
|
@ -138,8 +138,7 @@ class EditBlockFunctionCoder(Coder):
|
|||
content = self.io.read_text(full_path)
|
||||
content = do_replace(full_path, content, original, updated)
|
||||
if content:
|
||||
if not self.dry_run:
|
||||
self.io.write_text(full_path, content)
|
||||
self.io.write_text(full_path, content)
|
||||
edited.add(path)
|
||||
continue
|
||||
self.io.tool_error(f"Failed to apply edit to {path}")
|
||||
|
|
|
@ -64,9 +64,8 @@ class WholeFileCoder(Coder):
|
|||
else:
|
||||
if self.allowed_to_edit(fname):
|
||||
edited.add(fname)
|
||||
if not self.dry_run:
|
||||
new_lines = "".join(new_lines)
|
||||
self.io.write_text(full_path, new_lines)
|
||||
new_lines = "".join(new_lines)
|
||||
self.io.write_text(full_path, new_lines)
|
||||
|
||||
fname = None
|
||||
new_lines = []
|
||||
|
@ -123,8 +122,7 @@ class WholeFileCoder(Coder):
|
|||
full_path = self.allowed_to_edit(fname)
|
||||
if full_path:
|
||||
edited.add(fname)
|
||||
if not self.dry_run:
|
||||
new_lines = "".join(new_lines)
|
||||
self.io.write_text(full_path, new_lines)
|
||||
new_lines = "".join(new_lines)
|
||||
self.io.write_text(full_path, new_lines)
|
||||
|
||||
return edited
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue