mirror of
https://github.com/open-webui/computer.git
synced 2026-11-26 23:29:25 -05:00
refac
This commit is contained in:
1 parent
08d2afffc5
commit
6fdcbcfaa5
5 files changed
+246
-36
No files matched your search
@@ -25,6 +25,7 @@ from cptr.utils.git import (
|
||||
log,
|
||||
pull,
|
||||
push,
|
||||
rename_branch,
|
||||
show,
|
||||
stage,
|
||||
stash_list,
|
||||
@@ -145,6 +146,12 @@ class DeleteBranchRequest(BaseModel):
|
||||
name: str
|
||||
|
||||
|
||||
class RenameBranchRequest(BaseModel):
|
||||
root: str
|
||||
old_name: str
|
||||
new_name: str
|
||||
|
||||
|
||||
class RootRequest(BaseModel):
|
||||
root: str
|
||||
|
||||
@@ -235,6 +242,16 @@ async def git_delete_branch(body: DeleteBranchRequest):
|
||||
_handle_git_error(e)
|
||||
|
||||
|
||||
@router.patch("/branch")
|
||||
async def git_rename_branch(body: RenameBranchRequest):
|
||||
"""Rename a local branch."""
|
||||
try:
|
||||
await rename_branch(body.root, body.old_name, body.new_name)
|
||||
return {"ok": True}
|
||||
except GitError as e:
|
||||
_handle_git_error(e)
|
||||
|
||||
|
||||
@router.post("/pull")
|
||||
async def git_pull(body: RootRequest):
|
||||
"""Pull from remote."""
|
||||
|
||||
Reference in new issue
Block a user