Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: fix the release note script to pick up more backports #43302

Merged
merged 1 commit into from
Dec 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions scripts/release-notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,10 @@ def lookup_person(name, email):
# The following merge commits have been seen in the wild:
#
# Merge pull request #XXXXX from ... <- GitHub merges
# .... (#XXXX) <- GitHub merges (alt format)
# Merge #XXXXX #XXXXX #XXXXX <- Bors merges
merge_numbers = re.compile(r'^Merge( pull request)?(?P<numbers>( #[0-9]+)+)')
simple_merge = re.compile(r'.*\((?P<numbers>#[0-9]+)\)$', re.M)

### Initialization / option parsing ###

Expand Down Expand Up @@ -615,14 +617,14 @@ def analyze_pr(merge, pr):

noteexpr = re.compile("^%s: (?P<message>.*) r=.* a=.*" % pr[1:], flags=re.M)
m = noteexpr.search(merge.message)
note = ''
title = ''
if m is None:
# GitHub merge
note = merge.message.split('\n',3)[2]
title = merge.message.split('\n',3)[2]
else:
# Bors merge
note = m.group('message')
note = note.strip()
title = m.group('message')
title = title.strip()

merge_base_result = repo.merge_base(merge.parents[0], tip)
if len(merge_base_result) == 0:
Expand All @@ -647,7 +649,7 @@ def analyze_pr(merge, pr):
seen_commits.add(commit)

if not commit.message.startswith("Merge"):
missing_item, prauthors = process_release_notes(pr, note, commit)
missing_item, prauthors = process_release_notes(pr, title, commit)
authors.update(prauthors)
ncommits += 1
if missing_item is not None:
Expand All @@ -661,7 +663,7 @@ def analyze_pr(merge, pr):
text = repo.git.diff(merge_base.hexsha, tip.hexsha, '--', numstat=True)
stats = Stats._list_from_string(repo, text)

collect_item(pr, note, merge.hexsha[:shamin], ncommits, authors, stats.total, merge.committed_date)
collect_item(pr, title, merge.hexsha[:shamin], ncommits, authors, stats.total, merge.committed_date)


def collect_item(pr, prtitle, sha, ncommits, authors, stats, prts):
Expand Down Expand Up @@ -709,6 +711,10 @@ def analyze_standalone_commit(commit):

ctime = datetime.datetime.fromtimestamp(commit.committed_date).ctime()
numbermatch = merge_numbers.search(commit.message)
if numbermatch is None:
# Try again with the alternate format.
firstline = commit.message.split('\n', 1)[0]
numbermatch = simple_merge.search(firstline)
# Analyze the commit
if numbermatch is not None:
prs = numbermatch.group("numbers").strip().split(" ")
Expand Down