Fix handling tag on excluded commits and even if there is no message for this version
This commit is contained in:
parent
f659811be5
commit
70381153b9
1 changed files with 23 additions and 20 deletions
29
gitdch
29
gitdch
|
@ -248,13 +248,17 @@ def clean_deb_version(version_name):
|
||||||
|
|
||||||
def add_version():
|
def add_version():
|
||||||
""" Add version info """
|
""" Add version info """
|
||||||
if 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))
|
log.info('Add version %s:\n - %s', version, '\n - '.join(messages))
|
||||||
versions.append({
|
versions.append({
|
||||||
'name': version,
|
'name': version,
|
||||||
'tag': tag,
|
'tag': tag,
|
||||||
'commit': version_commit,
|
'commit': version_commit,
|
||||||
'messages': messages,
|
'messages': messages
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -268,18 +272,7 @@ version = (
|
||||||
)
|
)
|
||||||
messages = []
|
messages = []
|
||||||
for commit in repo.iter_commits(rev=options.revision):
|
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)
|
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:
|
if commit.binsha in tag_commits:
|
||||||
new_tag = tag_commits[commit.binsha]
|
new_tag = tag_commits[commit.binsha]
|
||||||
log.debug('Reach new tag %s', new_tag)
|
log.debug('Reach new tag %s', new_tag)
|
||||||
|
@ -291,6 +284,16 @@ for commit in repo.iter_commits(rev=options.revision):
|
||||||
version_commit = commit
|
version_commit = commit
|
||||||
messages = []
|
messages = []
|
||||||
log.debug('Iter commits for version %s', version)
|
log.debug('Iter commits for version %s', version)
|
||||||
|
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)
|
messages.append(commit.summary)
|
||||||
add_version()
|
add_version()
|
||||||
log.info('%d versions found', len(versions))
|
log.info('%d versions found', len(versions))
|
||||||
|
|
Loading…
Reference in a new issue