| | |
| | | ##### 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 |
| | |
| | | |
| | | |
| | | # 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 |