mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 06:15:00 +00:00
Saving dirty files before chat
This commit is contained in:
parent
8d6eafb1dc
commit
143683c7fd
1 changed files with 13 additions and 14 deletions
|
@ -42,7 +42,6 @@ class Coder:
|
||||||
self.console = Console(force_terminal=True, no_color=True)
|
self.console = Console(force_terminal=True, no_color=True)
|
||||||
|
|
||||||
self.commands = Commands(self.console, self)
|
self.commands = Commands(self.console, self)
|
||||||
self.commands.add("diff", self.cmd_diff, "Display the diff of the last aider commit")
|
|
||||||
self.main_model = main_model
|
self.main_model = main_model
|
||||||
if main_model == "gpt-3.5-turbo":
|
if main_model == "gpt-3.5-turbo":
|
||||||
self.console.print(
|
self.console.print(
|
||||||
|
@ -520,6 +519,19 @@ class Coder:
|
||||||
self.repo.git.reset("--hard", "HEAD~1")
|
self.repo.git.reset("--hard", "HEAD~1")
|
||||||
self.console.print(f"[red]Undid the last commit: {last_commit.message.strip()}")
|
self.console.print(f"[red]Undid the last commit: {last_commit.message.strip()}")
|
||||||
|
|
||||||
|
def cmd_diff(self, args):
|
||||||
|
"Display the diff of the last aider commit"
|
||||||
|
if not self.repo:
|
||||||
|
self.console.print("[red]No git repository found.")
|
||||||
|
return
|
||||||
|
|
||||||
|
if not self.last_aider_commit_hash:
|
||||||
|
self.console.print("[red]No previous aider commit found.")
|
||||||
|
return
|
||||||
|
|
||||||
|
diff = self.repo.git.diff(f"{self.last_aider_commit_hash}~1", self.last_aider_commit_hash)
|
||||||
|
self.console.print(Text(diff))
|
||||||
|
|
||||||
def cmd_add(self, args):
|
def cmd_add(self, args):
|
||||||
"Add matching files to the chat"
|
"Add matching files to the chat"
|
||||||
|
|
||||||
|
@ -544,19 +556,6 @@ class Coder:
|
||||||
self.fnames.remove(matched_file)
|
self.fnames.remove(matched_file)
|
||||||
self.console.print(f"[red]Removed {relative_fname} from the chat")
|
self.console.print(f"[red]Removed {relative_fname} from the chat")
|
||||||
|
|
||||||
def cmd_diff(self, args):
|
|
||||||
"Display the diff of the last aider commit"
|
|
||||||
if not self.repo:
|
|
||||||
self.console.print("[red]No git repository found.")
|
|
||||||
return
|
|
||||||
|
|
||||||
if not self.last_aider_commit_hash:
|
|
||||||
self.console.print("[red]No previous aider commit found.")
|
|
||||||
return
|
|
||||||
|
|
||||||
diff = self.repo.git.diff(f"{self.last_aider_commit_hash}~1", self.last_aider_commit_hash)
|
|
||||||
self.console.print(Text(diff))
|
|
||||||
|
|
||||||
def cmd_ls(self, args):
|
def cmd_ls(self, args):
|
||||||
"List files and show their chat status"
|
"List files and show their chat status"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue