refactor: move git operations into seperate files

This commit is contained in:
Sam Chau
2024-09-03 20:17:40 +09:30
parent 623f510ff9
commit ec7430466f
8 changed files with 208 additions and 120 deletions

View File

@@ -0,0 +1,15 @@
# git/operations/pull.py
import git
import logging
logger = logging.getLogger(__name__)
def pull_branch(repo_path, branch_name):
try:
repo = git.Repo(repo_path)
repo.git.pull('origin', branch_name)
return True, f"Successfully pulled changes for branch {branch_name}."
except Exception as e:
logger.error(f"Error pulling branch: {str(e)}", exc_info=True)
return False, f"Error pulling branch: {str(e)}"