1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-03 18:16:17 +01:00

osc search now returns sorted by project, and sorted by package,

not just sorted projects and random package order.
This commit is contained in:
Juergen Weigert 2010-08-12 20:21:04 +02:00
parent 1a5023ff28
commit 1b38b8c338

View File

@ -9,6 +9,7 @@ import cmdln
import conf
import oscerr
from optparse import SUPPRESS_HELP
import pprint
MAN_HEADER = r""".TH %(ucname)s "1" "%(date)s" "%(name)s %(version)s" "User Commands"
.SH NAME
@ -4866,7 +4867,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
print 'No matches found for \'%s\' in %ss' % (role_filter or search_term, kind)
continue
# construct a sorted, flat list
results.sort(lambda x, y: cmp(x[0], y[0]))
# Sort by first column, follwed by second column if we have two columns, else sort by first.
results.sort(lambda x, y:
(x[1] and y[1])
and
(cmp(x[0], y[0]) or cmp(x[1], y[1]))
or
cmp(x[0], y[0]))
new = []
for i in results:
new.extend(i)