]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
scripts: ceph-release-notes fixes --strict
authorLoic Dachary <ldachary@redhat.com>
Thu, 18 Feb 2016 08:10:14 +0000 (15:10 +0700)
committerLoic Dachary <ldachary@redhat.com>
Thu, 18 Feb 2016 08:10:14 +0000 (15:10 +0700)
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>
src/script/ceph-release-notes

index 19a55aab6357e780b85f1a1de0329006d6878beb..925c1d2388f902f56462a7dfec0345b3e9a88287 100755 (executable)
@@ -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: