From b018eade37c83c75663317edff14cac9d60669c4 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 11 May 2023 15:45:31 -0700 Subject: [PATCH] aider: Added `auto_commits` as a new argument to the `Coder()` class and updated `main()` function to pass the argument. # Context: USER: add auto_commits as a new arg to Coder(). assign it to self.auto_commit ASSISTANT: To add `auto_commits` as a new argument to the `Coder()` class and assign it to `self.auto_commit`, you need to update the `__init__` method in the `aider/coder.py` file: ```python aider/coder.py <<<<<<< ORIGINAL def __init__(self, main_model, fnames, pretty, history_file, show_diffs): ======= def __init__(self, main_model, fnames, pretty, history_file, show_diffs, auto_commits): >>>>>>> UPDATED self.history_file = history_file # ... (rest of the code remains unchanged) self.show_diffs = show_diffs <<<<<<< ORIGINAL ======= self.auto_commit = auto_commits >>>>>>> UPDATED ``` Then, update the `main()` function in the `aider/main.py` file to pass the `auto_commits` argument when creating a new `Coder` instance: ```python aider/main.py <<<<<<< ORIGINAL coder = Coder(args.model, fnames, pretty, args.history_file, args.show_diffs) ======= coder = Coder(args.model, fnames, pretty, args.history_file, args.show_diffs, args.auto_commits) >>>>>>> UPDATED coder.commit(ask=True, prefix="wip: ", which="repo_files") # ... (rest of the code remains unchanged) ``` --- aider/coder.py | 2 +- aider/main.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aider/coder.py b/aider/coder.py index 2f69b7a6c..588cc777f 100755 --- a/aider/coder.py +++ b/aider/coder.py @@ -33,7 +33,7 @@ class Coder: repo = None last_aider_commit_hash = None - def __init__(self, main_model, fnames, pretty, history_file, show_diffs): + def __init__(self, main_model, fnames, pretty, history_file, show_diffs, auto_commits): self.history_file = history_file if pretty: diff --git a/aider/main.py b/aider/main.py index 0a2a5d6c5..821394f5e 100644 --- a/aider/main.py +++ b/aider/main.py @@ -65,7 +65,7 @@ def main(): fnames = args.files pretty = args.pretty - coder = Coder(args.model, fnames, pretty, args.history_file, args.show_diffs) + coder = Coder(args.model, fnames, pretty, args.history_file, args.show_diffs, args.auto_commits) coder.commit(ask=True, prefix="wip: ", which="repo_files") if args.apply: