Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
from typing import Any
|
||||
from gitea.client import GiteaClient
|
||||
|
||||
|
||||
class GitTools:
|
||||
"""Tools for Gitea git ref operations."""
|
||||
|
||||
def __init__(self, client: GiteaClient) -> None:
|
||||
self._client = client
|
||||
|
||||
def create_branch(self, owner: str, repo: str, ref: str, sha: str) -> str:
|
||||
try:
|
||||
self._client.create_ref(owner, repo, ref, sha)
|
||||
return f"Branch '{ref}' created successfully in {owner}/{repo}."
|
||||
except Exception as e:
|
||||
return f"Error creating branch: {str(e)}"
|
||||
Reference in New Issue
Block a user