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
1 changed files with 23 additions and 10 deletions

View File

@ -16,7 +16,7 @@
# along with this program; if not, write to the Free Software Foundation
# 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
DESCRIPTION="update release changes"
@ -60,8 +60,11 @@ def print_category(category, entries):
if args.html:
print "<ul>"
for entry in sorted(entries):
print format_logentry(entry)
tmp_entries = collections.OrderedDict(sorted(entries.items()))
for cat, entry_list in tmp_entries.iteritems():
for entry in entry_list:
print format_logentry(entry)
if args.html:
print "</ul>"
@ -108,9 +111,10 @@ if changes:
offset = 0
features = []
bugfixes = []
support = []
features = {}
bugfixes = {}
support = {}
category = ""
while True:
# 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
if "category" in issue:
category = issue["category"]["name"]
category = str(issue["category"]["name"])
else:
category = "no category"
@ -144,11 +148,20 @@ while True:
entry = (issue["tracker"]["name"], issue["id"], category, issue["subject"].strip())
if issue["tracker"]["name"] == "Feature":
features.append(entry)
try:
features[category].append(entry)
except KeyError:
features[category] = [ entry ]
elif issue["tracker"]["name"] == "Bug":
bugfixes.append(entry)
try:
bugfixes[category].append(entry)
except KeyError:
bugfixes[category] = [ entry ]
elif issue["tracker"]["name"] == "Support":
support.append(entry)
try:
support[category].append(entry)
except KeyError:
support[category] = [ entry ]
print_category("Feature", features)
print_category("Bugfixes", bugfixes)