Show More
@@ -195,11 +195,8 b' class hgwebdir(object):' | |||
|
195 | 195 | yield {"type" : i[0], "extension": i[1], |
|
196 | 196 | "node": nodeid, "url": url} |
|
197 | 197 | |
|
198 | sortdefault = None, False | |
|
199 | def entries(sortcolumn="", descending=False, subdir="", **map): | |
|
198 | def rawentries(subdir="", **map): | |
|
200 | 199 | |
|
201 | rows = [] | |
|
202 | parity = paritygen(self.stripecount) | |
|
203 | 200 | descend = self.ui.configbool('web', 'descend', True) |
|
204 | 201 | for name, path in self.repos: |
|
205 | 202 | |
@@ -253,18 +250,18 b' class hgwebdir(object):' | |||
|
253 | 250 | lastchange=d, |
|
254 | 251 | lastchange_sort=d[1]-d[0], |
|
255 | 252 | archives=archivelist(u, "tip", url)) |
|
256 | if (not sortcolumn or (sortcolumn, descending) == sortdefault): | |
|
257 | # fast path for unsorted output | |
|
258 | row['parity'] = parity.next() | |
|
259 | 253 |
|
|
260 | else: | |
|
261 | rows.append((row["%s_sort" % sortcolumn], row)) | |
|
262 | if rows: | |
|
263 | rows.sort() | |
|
264 | if descending: | |
|
265 | rows.reverse() | |
|
266 | for key, row in rows: | |
|
267 | row['parity'] = parity.next() | |
|
254 | ||
|
255 | sortdefault = None, False | |
|
256 | def entries(sortcolumn="", descending=False, subdir="", **map): | |
|
257 | rows = rawentries(subdir=subdir, **map) | |
|
258 | ||
|
259 | if sortcolumn and sortdefault != (sortcolumn, descending): | |
|
260 | sortkey = '%s_sort' % sortcolumn | |
|
261 | rows = sorted(rows, key=lambda x: x[sortkey], | |
|
262 | reverse=descending) | |
|
263 | for row, parity in zip(rows, paritygen(self.stripecount)): | |
|
264 | row['parity'] = parity | |
|
268 | 265 |
|
|
269 | 266 | |
|
270 | 267 | self.refresh() |
General Comments 0
You need to be logged in to leave comments.
Login now