mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-07 21:24:59 +00:00
refactor: split cmd_undo and cmd_commit into raw and exception-handling methods
This commit is contained in:
parent
bb9cb629e4
commit
8609594c0e
1 changed files with 11 additions and 0 deletions
|
@ -231,7 +231,12 @@ class Commands:
|
||||||
|
|
||||||
def cmd_commit(self, args=None):
|
def cmd_commit(self, args=None):
|
||||||
"Commit edits to the repo made outside the chat (commit message optional)"
|
"Commit edits to the repo made outside the chat (commit message optional)"
|
||||||
|
try:
|
||||||
|
self.cmd_commit_raw(args)
|
||||||
|
except ANY_GIT_ERROR as err:
|
||||||
|
self.io.tool_error(f"Unable to complete commit: {err}")
|
||||||
|
|
||||||
|
def cmd_commit_raw(self, args=None):
|
||||||
if not self.coder.repo:
|
if not self.coder.repo:
|
||||||
self.io.tool_error("No git repository found.")
|
self.io.tool_error("No git repository found.")
|
||||||
return
|
return
|
||||||
|
@ -423,6 +428,12 @@ class Commands:
|
||||||
|
|
||||||
def cmd_undo(self, args):
|
def cmd_undo(self, args):
|
||||||
"Undo the last git commit if it was done by aider"
|
"Undo the last git commit if it was done by aider"
|
||||||
|
try:
|
||||||
|
self.cmd_undo_raw(args)
|
||||||
|
except ANY_GIT_ERROR as err:
|
||||||
|
self.io.tool_error(f"Unable to complete undo: {err}")
|
||||||
|
|
||||||
|
def cmd_undo_raw(self, args):
|
||||||
if not self.coder.repo:
|
if not self.coder.repo:
|
||||||
self.io.tool_error("No git repository found.")
|
self.io.tool_error("No git repository found.")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue