diff --git a/scripts/release-notes.py b/scripts/release-notes.py index cb3bf6208238..8f32a8592f44 100755 --- a/scripts/release-notes.py +++ b/scripts/release-notes.py @@ -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( #[0-9]+)+)') +simple_merge = re.compile(r'.*\((?P#[0-9]+)\)$', re.M) ### Initialization / option parsing ### @@ -615,14 +617,14 @@ def analyze_pr(merge, pr): noteexpr = re.compile("^%s: (?P.*) 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: @@ -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: @@ -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): @@ -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(" ")