mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 06:44: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))
|
full_path = os.path.abspath(os.path.join(self.root, path))
|
||||||
|
|
||||||
if full_path in self.abs_fnames:
|
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)
|
self.io.write_text(full_path, write_content)
|
||||||
return full_path
|
return full_path
|
||||||
|
|
||||||
|
@ -949,7 +949,7 @@ class Coder:
|
||||||
if not self.dry_run:
|
if not self.dry_run:
|
||||||
self.repo.git.add(full_path)
|
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)
|
self.io.write_text(full_path, write_content)
|
||||||
|
|
||||||
return full_path
|
return full_path
|
||||||
|
|
|
@ -29,7 +29,6 @@ class EditBlockCoder(Coder):
|
||||||
content = self.io.read_text(full_path)
|
content = self.io.read_text(full_path)
|
||||||
content = do_replace(full_path, content, original, updated)
|
content = do_replace(full_path, content, original, updated)
|
||||||
if content:
|
if content:
|
||||||
if not self.dry_run:
|
|
||||||
self.io.write_text(full_path, content)
|
self.io.write_text(full_path, content)
|
||||||
edited.add(path)
|
edited.add(path)
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -138,7 +138,6 @@ class EditBlockFunctionCoder(Coder):
|
||||||
content = self.io.read_text(full_path)
|
content = self.io.read_text(full_path)
|
||||||
content = do_replace(full_path, content, original, updated)
|
content = do_replace(full_path, content, original, updated)
|
||||||
if content:
|
if content:
|
||||||
if not self.dry_run:
|
|
||||||
self.io.write_text(full_path, content)
|
self.io.write_text(full_path, content)
|
||||||
edited.add(path)
|
edited.add(path)
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -64,7 +64,6 @@ class WholeFileCoder(Coder):
|
||||||
else:
|
else:
|
||||||
if self.allowed_to_edit(fname):
|
if self.allowed_to_edit(fname):
|
||||||
edited.add(fname)
|
edited.add(fname)
|
||||||
if not self.dry_run:
|
|
||||||
new_lines = "".join(new_lines)
|
new_lines = "".join(new_lines)
|
||||||
self.io.write_text(full_path, new_lines)
|
self.io.write_text(full_path, new_lines)
|
||||||
|
|
||||||
|
@ -123,7 +122,6 @@ class WholeFileCoder(Coder):
|
||||||
full_path = self.allowed_to_edit(fname)
|
full_path = self.allowed_to_edit(fname)
|
||||||
if full_path:
|
if full_path:
|
||||||
edited.add(fname)
|
edited.add(fname)
|
||||||
if not self.dry_run:
|
|
||||||
new_lines = "".join(new_lines)
|
new_lines = "".join(new_lines)
|
||||||
self.io.write_text(full_path, new_lines)
|
self.io.write_text(full_path, new_lines)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue