From 4f41bd348887bbabf6902426d8aba958493fac65 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Wed, 24 Jun 2026 11:45:05 +0200 Subject: [PATCH] feat: daemon polls Gitea for new commits before sync_git_to_svn --- svn_mirror/gitea.py | 11 ++--------- svn_mirror/sync.py | 3 ++- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/svn_mirror/gitea.py b/svn_mirror/gitea.py index 1332842..8bc7df9 100644 --- a/svn_mirror/gitea.py +++ b/svn_mirror/gitea.py @@ -127,12 +127,5 @@ def fetch_from_gitea(mirror: Mirror, ref: Optional[str] = None) -> bool: timeout=300, ) - # Check if anything changed - out = _git("--git-dir", canonical, "rev-list", "--count", - f"HEAD..FETCH_HEAD", timeout=30, check=False) - if out and out.strip() != "0": - logger.info("Fetched new commits from Gitea") - return True - - logger.debug("No new commits from Gitea") - return False + logger.debug("Fetch from Gitea complete") + return True diff --git a/svn_mirror/sync.py b/svn_mirror/sync.py index 53d8410..c5eaa01 100644 --- a/svn_mirror/sync.py +++ b/svn_mirror/sync.py @@ -13,7 +13,7 @@ from typing import Dict, List, Optional, Tuple from .config import MirrorConfig from .mirror import Mirror -from .gitea import push_to_gitea, GiteaError +from .gitea import fetch_from_gitea, push_to_gitea, GiteaError from .git_to_svn import sync_git_to_svn from .svn import ( SVNPathChange, @@ -485,6 +485,7 @@ def run_daemon_loop(mirrors: Dict[str, Mirror]) -> None: svn_count = sync_all(m) if svn_count: push_to_gitea(m) + fetch_from_gitea(m) git_count = sync_git_to_svn(m) if svn_count or git_count: last_sync[mid] = now