032: T045 — git services async (run_blocking for all blocking ops)

_merge.py partially done. Tests still pending.
This commit is contained in:
2026-06-04 20:36:33 +03:00
parent 5ca1131ba3
commit 27bbf057ec
9 changed files with 70 additions and 64 deletions

View File

@@ -21,10 +21,10 @@ class GitServiceSyncMixin:
# @PURPOSE: Push local commits to remote (concurrent-safe).
# @PRE Repository exists and has an 'origin' remote.
# @POST Local branch commits are pushed to origin.
def push_changes(self, dashboard_id: int):
async def push_changes(self, dashboard_id: int):
with self._locked(dashboard_id):
with belief_scope("GitService.push_changes"):
repo = self.get_repo(dashboard_id)
repo = await self.get_repo(dashboard_id)
if not repo.heads:
logger.warning(f"[push_changes][Coherence:Failed] No local branches to push for dashboard {dashboard_id}")
return
@@ -115,10 +115,10 @@ class GitServiceSyncMixin:
# @PURPOSE: Pull changes from remote (concurrent-safe).
# @PRE Repository exists and has an 'origin' remote.
# @POST Changes from origin are pulled and merged into the active branch.
def pull_changes(self, dashboard_id: int):
async def pull_changes(self, dashboard_id: int):
with self._locked(dashboard_id):
with belief_scope("GitService.pull_changes"):
repo = self.get_repo(dashboard_id)
repo = await self.get_repo(dashboard_id)
merge_head_path = os.path.join(repo.git_dir, "MERGE_HEAD")
if os.path.exists(merge_head_path):
payload = self._build_unfinished_merge_payload(repo)