diff --git a/HACKING.md b/HACKING.md index ce573a526e8..a862c25c428 100644 --- a/HACKING.md +++ b/HACKING.md @@ -433,8 +433,9 @@ the behavior change which is important. This implies that refactorings that have no visible effect on behavior don't need a changelog entry. If a changelog entry is needed, your pull request should have at least one -commit with a "Changelog:" line in it, after the title. This may be one of the -following: +commit either with a "Changelog:" line in it (anywhere after the title), or +title should start with ticket number from our bug tracker ("CFE-1234"). +"Changelog:" line may be one of the following: * To write arbitrary message in the ChangeLog: `Changelog: ` diff --git a/misc/changelog-generator/changelog-generator b/misc/changelog-generator/changelog-generator index 67c6139dfd6..ce53d182322 100755 --- a/misc/changelog-generator/changelog-generator +++ b/misc/changelog-generator/changelog-generator @@ -20,13 +20,16 @@ LINKED_SHAS = {} # messages. SHA_TO_TRACKER = {} +# more relaxed regexp to find JIRA issues anywhere in commit message JIRA_REGEX = r"(?:Jira:? *)?(?:https?://tracker.mender.io/browse/)?((?:CFE|ENT|INF|ARCHIVE|MEN|QA)-[0-9]+)" +# more strict regexp to find JIRA issues only in the beginning of title +JIRA_TITLE_REGEX = r"(?:CFE|ENT|INF|ARCHIVE|MEN|QA)-[0-9]+" TRACKER_REGEX = r"\(?(?:Ref:? *)?%s\)?:? *" % (JIRA_REGEX) POSSIBLE_MISSED_TICKETS = {} # Only for testing. -SORT_CHANGELOG = False +SORT_CHANGELOG = True # Type of log to generate, this is bitwise. LOG_TYPE = 0 @@ -140,7 +143,10 @@ for repo in repos: SHA_TO_TRACKER[sha] = set() SHA_TO_TRACKER[sha].add("".join(match.groups(""))) tracker_removed = re.sub(TRACKER_REGEX, "", line, flags=re.IGNORECASE) - line = tracker_removed.strip(' ') + tracker_removed = tracker_removed.strip(' ') + if re.match(JIRA_TITLE_REGEX, line) and not title_fetched: + log_entry = tracker_removed + line = tracker_removed if not title_fetched: title = line