Generics & visitor pattern?
This commit is contained in:
parent
3845cc7ecf
commit
1440ec51b7
4 changed files with 33 additions and 6 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue