changelog.py: Sort by category

fixes #13245
This commit is contained in:
Michael Friedrich 2016-11-18 15:28:27 +01:00
parent ca7f195165
commit aca4af801b

View File

@ -16,7 +16,7 @@
# along with this program; if not, write to the Free Software Foundation # along with this program; if not, write to the Free Software Foundation
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
import urllib2, json, sys, string import urllib2, json, sys, string, collections
from argparse import ArgumentParser from argparse import ArgumentParser
DESCRIPTION="update release changes" DESCRIPTION="update release changes"
@ -60,8 +60,11 @@ def print_category(category, entries):
if args.html: if args.html:
print "<ul>" print "<ul>"
for entry in sorted(entries): tmp_entries = collections.OrderedDict(sorted(entries.items()))
print format_logentry(entry)
for cat, entry_list in tmp_entries.iteritems():
for entry in entry_list:
print format_logentry(entry)
if args.html: if args.html:
print "</ul>" print "</ul>"
@ -108,9 +111,10 @@ if changes:
offset = 0 offset = 0
features = [] features = {}
bugfixes = [] bugfixes = {}
support = [] support = {}
category = ""
while True: while True:
# We could filter using &cf_13=1, however this doesn't currently work because the custom field isn't set # We could filter using &cf_13=1, however this doesn't currently work because the custom field isn't set
@ -136,7 +140,7 @@ while True:
continue continue
if "category" in issue: if "category" in issue:
category = issue["category"]["name"] category = str(issue["category"]["name"])
else: else:
category = "no category" category = "no category"
@ -144,11 +148,20 @@ while True:
entry = (issue["tracker"]["name"], issue["id"], category, issue["subject"].strip()) entry = (issue["tracker"]["name"], issue["id"], category, issue["subject"].strip())
if issue["tracker"]["name"] == "Feature": if issue["tracker"]["name"] == "Feature":
features.append(entry) try:
features[category].append(entry)
except KeyError:
features[category] = [ entry ]
elif issue["tracker"]["name"] == "Bug": elif issue["tracker"]["name"] == "Bug":
bugfixes.append(entry) try:
bugfixes[category].append(entry)
except KeyError:
bugfixes[category] = [ entry ]
elif issue["tracker"]["name"] == "Support": elif issue["tracker"]["name"] == "Support":
support.append(entry) try:
support[category].append(entry)
except KeyError:
support[category] = [ entry ]
print_category("Feature", features) print_category("Feature", features)
print_category("Bugfixes", bugfixes) print_category("Bugfixes", bugfixes)