rely on io.dry_run

This commit is contained in:
Paul Gauthier 2023-07-05 21:21:37 -07:00
parent 4ee5c49a04
commit 85c3bb8f12
4 changed files with 8 additions and 12 deletions

View file

@ -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

View file

@ -29,7 +29,6 @@ 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)
edited.add(path)
continue

View file

@ -138,7 +138,6 @@ 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)
edited.add(path)
continue

View file

@ -64,7 +64,6 @@ 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)
@ -123,7 +122,6 @@ 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)