Daniel Fütterer
24.01.21 1092d6b890a93bcfd21010a1392034c6d6de2de1
fix: no tag in latest commit required
1 Dateien geändert
17 ■■■■ Geänderte Dateien
changelog_generator.py 17 ●●●● Patch | Ansicht | Raw | Blame | Historie
changelog_generator.py
@@ -4,7 +4,6 @@
##### To Do #####
# - handle different keywords/types (what to process/ignore?)
# - scopes
# - at the moment the script requires a tag in the latest commit to work properly
# the processing ang recognizing of the commit components should be improved
import os
@@ -57,18 +56,28 @@
# Grouping History using tags
for commit in commitHistory: # latest commit must have a tag
for commit in commitHistory:
    # Look if commit has a tag
    if (len(commit) == 3) and ("tag: v" in commit[2]):
        taggedHistory.append([commit[2][(commit[2].rfind(": v")+3):-1],commit[0:2]])
    else:
        taggedHistory[-1].append(commit)
        # Check if latest commit has a tag
        if len(taggedHistory)==0:
            # If there is no tag, create empty string instead
            taggedHistory.append(["", commit])
        else:
            taggedHistory[-1].append(commit)
# Construction of the changelog-file
fileTemplate = ["# Changelog"]
for tag in taggedHistory:
    fileTemplate.append("\n## Version " + tag[0])
    if tag[0] == "":
        fileTemplate.append("\n## No version number yet ")
    else:
        fileTemplate.append("\n## Version " + tag[0])
    for commit in tag[1:]:
        fileTemplate.append("\t- " + commit[0] + " (" + commit[1] + ")")
# write into changelog