fix: Add undo hint after running one command

This commit is contained in:
Paul Gauthier 2024-08-09 19:47:17 -04:00 committed by Paul Gauthier (aider)
parent 0b4a3d7b3c
commit 30d506ab82

View file

@ -685,6 +685,7 @@ class Coder:
try: try:
user_message = self.get_input() user_message = self.get_input()
self.run_one(user_message) self.run_one(user_message)
self.show_undo_hint()
except KeyboardInterrupt: except KeyboardInterrupt:
self.keyboard_interrupt() self.keyboard_interrupt()
except EOFError: except EOFError:
@ -1657,11 +1658,11 @@ class Coder:
if self.show_diffs: if self.show_diffs:
self.commands.cmd_diff() self.commands.cmd_diff()
def show_undo_hint(self, commit_hash): def show_undo_hint(self):
if not self.commit_before_message: if not self.commit_before_message:
return return
if self.commit_before_message != self.repo.get_head(): if self.commit_before_message != self.repo.get_head():
self.io.tool_output(f"You can use /undo to revert and discard commit {commit_hash}.") self.io.tool_output(f"You can use /undo to undo and discard each aider commit.")
def dirty_commit(self): def dirty_commit(self):
if not self.need_commit_before_edits: if not self.need_commit_before_edits: