34 lines
943 B
Python
34 lines
943 B
Python
import os
|
|
import subprocess as sub
|
|
from system_repository import SystemRepository
|
|
from release_type import ReleaseType
|
|
|
|
# define semantics for release types by commit messages
|
|
## snapshot - snapshot release
|
|
## fix/patch - patch release
|
|
## bump - version bump release
|
|
## feature/feat/minor - minor release
|
|
## major/breaking - major release
|
|
|
|
GIT = 'git'
|
|
LOG = 'log'
|
|
FORMAT = '"%h %s"'
|
|
FORMAT_DEC = "%d"
|
|
PRETTY_OPTION = '--pretty='
|
|
DECORATE_OPTION = '--decorate=full'
|
|
|
|
|
|
# git log --oneline --format="%s %b" origin/master...HEAD
|
|
|
|
class GitRepo():
|
|
|
|
def __init__(self):
|
|
self.latest_commit = None
|
|
self.system_repository = SystemRepository()
|
|
|
|
def get_latest_commit(self):
|
|
self.latest_commit = self.system_repository.run_checked('git', 'log', '--oneline', '--format="%s %b"', '-n' + '1')
|
|
|
|
def get_release_type_from_latest_commit(self):
|
|
if self.latest_commit is None:
|
|
self.get_latest_commit()
|