Files
profilarr/backend/app/git/branches/manager.py
2025-02-05 16:09:58 +10:30

30 lines
896 B
Python

# git/branches/branches.py
import git
from .create import create_branch
from .checkout import checkout_branch
from .delete import delete_branch
from .get import get_branches, get_current_branch
from .push import push_branch_to_remote
class Branch_Manager:
def __init__(self, repo_path):
self.repo_path = repo_path
def create(self, branch_name, base_branch='main'):
return create_branch(self.repo_path, branch_name, base_branch)
def checkout(self, branch_name):
return checkout_branch(self.repo_path, branch_name)
def delete(self, branch_name):
return delete_branch(self.repo_path, branch_name)
def get_all(self):
return get_branches(self.repo_path)
def get_current(self):
return get_current_branch(self.repo_path)
def push(self, branch_name):
return push_branch_to_remote(self.repo_path, branch_name)