From b3f8dd8c798730cb7eb8d47f8469bf097adf3cd9 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Thu, 18 Feb 2016 15:10:14 +0700 Subject: [PATCH] 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 --- src/script/ceph-release-notes | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/script/ceph-release-notes b/src/script/ceph-release-notes index 19a55aab635..925c1d2388f 100755 --- a/src/script/ceph-release-notes +++ b/src/script/ceph-release-notes @@ -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: