Generics & visitor pattern?

This commit is contained in:
Piotr Dec 2025-10-30 21:05:06 +01:00
parent 3845cc7ecf
commit 1440ec51b7
Signed by: stawros
GPG key ID: 74B18A3F0F1E99C0
4 changed files with 33 additions and 6 deletions

View file

@ -13,15 +13,19 @@ class GitService:
self._repo.git.checkout(self._settings.git.branch)
self._origin: Remote = self._repo.remotes.origin
def get_modified_compose(self) -> str | None:
self._update()
return self._diff()
def get_new_commit_hash(self) -> str:
self._update()
return self._repo.head.commit.hexsha
@staticmethod
def _check_preconditions(config: GitConfig) -> Repo:
def clone():
return Repo.clone_from(config.url, config.path, branch=config.branch)
import os
if not config.path.exists():
return clone()