diff --git a/util/changelog.py b/util/changelog.py old mode 100644 new mode 100755 index eaaaa432..dd61cc0d --- a/util/changelog.py +++ b/util/changelog.py @@ -3,14 +3,16 @@ import copy import sys """ -Changelog generation script, requires PAT see https://github.com/settings/tokens +Changelog generation script, requires PAT with public_repo access, +see https://github.com/settings/tokens + Caveats V20 and prior release tags are tips on their respective release branches If you try to use a start tag with one of these a full changelog will be generated since the commit wont appear in your iterations """ try: - from github import Github + from github import Github,UnknownObjectException from mdutils import MdUtils except BaseException: sys.exit("Error: run 'pip install PyGithub mdutils'") @@ -45,6 +47,10 @@ SECTIONS = { "Developer Wallet": [ "qt wallet", ], + "Ledger & Database": [ + "database", + "database structure", + ], "Developer/Debug Options": [ "debug", "logging", @@ -55,13 +61,13 @@ SECTIONS = { "Implemented Enhancements": [ "enhancement", "functionality quality improvements", - "non-functional change", "performance", "quality improvements", ], - "Build, Test, Automation, & Chores": [ + "Build, Test, Automation, Cleanup & Chores": [ "build-error", "documentation", + "non-functional change", "routine", "sanitizers", "static-analysis", @@ -108,16 +114,12 @@ class cliArgs(): self.start = options.start self.end = options.end self.pat = options.pat - def __repr__(self): return "" \ .format(self.repo, self.start, self.end, self.pat) - def __str__(self): return "Generating a changelog for {0} starting with {1} " \ "and ending with {2}".format(self.repo, self.start, self.end) - - class generateTree: def __init__(self, args): github = Github(args.pat) @@ -145,86 +147,80 @@ class generateTree: pr_number = int( message[message.rfind('#')+1:message.rfind(')')]) pull = self.repo.get_pull(pr_number) - labels = [] - for label in pull.labels: - labels.append(label.name) - self.commits[pull.number] = { - "Title": pull.title, - "Url": pull.html_url, - "labels": labels - } - except ValueError: - print("Commit has no associated PR {}: \"{}\"".format( + except (ValueError, UnknownObjectException): + pulls = commit.get_pulls() + if pulls.totalCount > 0: + # no commits with more than 1 PR associated to it were found in V23 release + # but targeting first entry only if that ends up being the case + pr_number = pulls[0].number + pull = self.repo.get_pull(pr_number) + else: + print("Commit has no associated PR {}: \"{}\"".format( commit.sha, message)) - self.other_commits.append((commit.sha, message)) - continue + self.other_commits.append((commit.sha, message)) + continue + labels = [] + for label in pull.labels: + labels.append(label.name) + self.commits[pull.number] = { + "Title": pull.title, + "Url": pull.html_url, + "labels": labels + } def __repr__(self): return " 0: result[a] = sect[a] return result - - if __name__ == "__main__": args = cliArgs() repo = generateTree(args)