merge conflict fixing finalisation

This commit is contained in:
armistace 2025-05-30 16:36:18 +10:00
parent b87dc1da9e
commit 7c724d8177
2 changed files with 4 additions and 1 deletions

View File

@ -32,4 +32,3 @@ for note in tril_notes:
git_pass = os.environ["GIT_PASS"]
repo_manager = git_repo.GitRepository("blog/", git_user, git_pass)
repo_manager.create_copy_commit_push(blog_path, os_friendly_title, commit_message)
ai_gen.save_to_file(f"/blog_creator/generated_files/{os_friendly_title}.md")

View File

@ -24,6 +24,7 @@ class GitRepository:
if os.path.exists(repo_path):
shutil.rmtree(repo_path)
self.repo_path = repo_path
print("Cloning Repo")
Repo.clone_from(remote, repo_path)
self.repo = Repo(repo_path)
self.username = username
@ -49,6 +50,7 @@ class GitRepository:
def pull(self, remote_name='origin', ref_name='main'):
"""Pull updates from a remote repository with authentication"""
print("Pulling Latest Updates (if any)")
try:
self.repo.remotes[remote_name].pull(ref_name)
return True
@ -64,6 +66,7 @@ class GitRepository:
def create_and_switch_branch(self, branch_name, remote_name='origin', ref_name='main'):
"""Create a new branch in the repository with authentication."""
try:
pring(f"Creating Branch {title}")
# Use the same remote and ref as before
self.repo.git.branch(branch_name)
except GitCommandError:
@ -74,6 +77,7 @@ class GitRepository:
def add_and_commit(self, message=None):
"""Add and commit changes to the repository."""
try:
print("Commiting latest draft")
# Add all changes
self.repo.git.add(all=True)
# Commit with the provided message or a default