Skip to content

Commit

Permalink
ENT-3638: Add commit title to changelog by default, if it has ticket …
Browse files Browse the repository at this point in the history
…number

From now on, you don't need to write "Changelog: title" if you prepend
title with JIRA ticket number

Signed-off-by: Aleksei Shpakovskii <aleksei.shpakovskii@cfengine.com>
  • Loading branch information
Aleksei Shpakovskii committed May 2, 2018
1 parent 6ffdef3 commit 47f1059
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions HACKING.md
Expand Up @@ -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: <message>`
Expand Down
10 changes: 8 additions & 2 deletions misc/changelog-generator/changelog-generator
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 47f1059

Please sign in to comment.