Skip to content

Latest

LatestVersionStrategy

Bases: VersionStrategyBase

Strategy to get the latest version of a project from a VCS repository (e.g. git)

Source code in src/vcs/latest.py
 9
10
11
12
13
14
15
16
17
18
class LatestVersionStrategy(VersionStrategyBase):
    """
    Strategy to get the latest version of a project from a VCS repository (e.g. git)
    """
    def get_versions(self, repository: Repo) -> List[Version]:
        commits = list(repository.iter_commits('--all'))
        commit = commits[0]

        return [Version(commit_id=commit.hexsha, commit_num=len(commits),
                        commit_date=commit.committed_datetime, files=None)]