scripts: ceph-release-notes fixes --strict

When --strict,

* Do not take into account the merge message. This is is not used
  for backports
* Avoid duplicates by storing the issues in a set
* Display the list of PRs when more than one are found for a single
  issue.

Signed-off-by: Loic Dachary <loic@dachary.org>
This commit is contained in:
Loic Dachary 2016-02-18 15:10:14 +07:00
parent b7524c0a68
commit b3f8dd8c79

View File

@ -83,7 +83,7 @@ def make_release_notes(gh, repo, ref, plaintext, verbose, strict):
number = merge.group(1)
pr = gh.repos("ceph")("ceph").pulls(number).get()
message_lines = commit.message.split('\n')
if len(message_lines) > 1:
if not strict and len(message_lines) > 1:
lines = []
for line in message_lines[1:]:
if 'Reviewed-by' in line:
@ -121,24 +121,27 @@ def make_release_notes(gh, repo, ref, plaintext, verbose, strict):
title = pr['title']
if strict:
title_re = '^(cli|common|mon|osd|fs|librbd|rbd|fs|mds|objecter|rgw|build/ops|tests|tools|cmake|doc|crush|librados):'
if not re.match(title_re, title):
title_re = '^(?:hammer|infernalis|jewel|kraken): (cli|common|mon|osd|fs|librbd|rbd|fs|mds|objecter|rgw|build/ops|tests|tools|cmake|doc|crush|librados)(:.*)'
match = re.match(title_re, title)
if not match:
print ("ERROR: http://github.com/ceph/ceph/pull/" + str(number) + " title " + title + " does not match " + title_re)
else:
title = match.group(1) + match.group(2)
pr2info[number] = (author, title, message)
for issue in set(issues):
issue = get_original_issue(issue, verbose)
issue2prs.setdefault(issue, []).append(number)
pr2issues.setdefault(number, []).append(issue)
sys.stdout.write('.')
issue2prs.setdefault(issue, set([])).add(number)
pr2issues.setdefault(number, set([])).add(issue)
sys.stdout.write('.')
print (" done collecting merges.")
if strict:
for (issue, prs) in issue2prs.iteritems():
if len(prs) > 1:
print (">>>>>>> " + str(len(prs)) + " pr for issue " + issue)
print (">>>>>>> " + str(len(prs)) + " pr for issue " + issue + " " + str(prs))
for (pr, (author, title, message)) in sorted(pr2info.iteritems(), key=lambda (k,v): (v[2], v[1])):
if pr in pr2issues: