Detector: almost complete

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
2022-08-03 16:42:29 +02:00
parent 52c3d03e2f
commit 5ca24960c3
7 changed files with 715 additions and 0 deletions

View File

@@ -218,6 +218,24 @@ class RepoTool:
def list_commits(self, max_depth: Optional[int] = None):
return self._repo.iter_commits(all = True, max_count = max_depth, reverse = True)
@__check_initialized
def list_branches(self) -> Union[dict, bool]:
log.debug(f"Listing branches of repo")
branches = {}
for branch in self._repo.branches:
branches[branch.name] = branch.commit.hexsha
log.debug(f"Found {len(branches)}")
return branches
@__check_initialized
def list_tags(self):
log.debug(f"Listing tags of repo")
tags = {}
for tag in self._repo.tags:
tags[tag.name] = tag.commit.hexsha
log.debug(f"Found {len(tags)} tags")
return tags
@__check_initialized
def list_submodules(self, commit: str = "HEAD") -> Union[list, bool]:
commit = self._repo.commit(commit)