Fix handling tag on excluded commits and even if there is no message for this version
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
Benjamin Renard 2022-12-12 19:15:55 +01:00
parent f659811be5
commit 70381153b9

43
gitdch
View file

@ -248,14 +248,18 @@ def clean_deb_version(version_name):
def add_version():
""" Add version info """
if messages:
log.info('Add version %s:\n - %s', version, '\n - '.join(messages))
versions.append({
'name': version,
'tag': tag,
'commit': version_commit,
'messages': messages,
})
global messages # pylint: disable=global-statement
if not version_commit:
return
if not messages:
messages = ['Release version {0}'.format(version)]
log.info('Add version %s:\n - %s', version, '\n - '.join(messages))
versions.append({
'name': version,
'tag': tag,
'commit': version_commit,
'messages': messages
})
tag = None
@ -268,18 +272,7 @@ version = (
)
messages = []
for commit in repo.iter_commits(rev=options.revision):
if version_commit is None:
version_commit = commit
log.debug('Commit %s (%s)', commit, commit.summary)
excluded = False
for regex in options.exclude:
if regex.search(commit.summary):
excluded = True
log.debug(
'Exclude commit %s ("%s", match with "%s")',
commit, commit.summary, regex.pattern)
if excluded:
continue
if commit.binsha in tag_commits:
new_tag = tag_commits[commit.binsha]
log.debug('Reach new tag %s', new_tag)
@ -291,7 +284,17 @@ for commit in repo.iter_commits(rev=options.revision):
version_commit = commit
messages = []
log.debug('Iter commits for version %s', version)
messages.append(commit.summary)
if version_commit is None:
version_commit = commit
excluded = False
for regex in options.exclude:
if regex.search(commit.summary):
excluded = True
log.debug(
'Exclude commit %s ("%s", match with "%s")',
commit, commit.summary, regex.pattern)
if not excluded:
messages.append(commit.summary)
add_version()
log.info('%d versions found', len(versions))