##// END OF EJS Templates
hgweb: get rid of inaccurate hgwebdir.repos_sorted, localize machinery
Dirkjan Ochtman -
r8346:b579823c default
parent child Browse files
Show More
@@ -30,11 +30,8 b' class hgwebdir(object):'
30 self.ui.setconfig('ui', 'report_untrusted', 'off')
30 self.ui.setconfig('ui', 'report_untrusted', 'off')
31 self.ui.setconfig('ui', 'interactive', 'off')
31 self.ui.setconfig('ui', 'interactive', 'off')
32
32
33 self.repos_sorted = ('name', False)
34
35 if isinstance(conf, (list, tuple)):
33 if isinstance(conf, (list, tuple)):
36 self.repos = cleannames(conf)
34 self.repos = cleannames(conf)
37 self.repos_sorted = ('', False)
38 elif isinstance(conf, dict):
35 elif isinstance(conf, dict):
39 self.repos = sorted(cleannames(conf.items()))
36 self.repos = sorted(cleannames(conf.items()))
40 else:
37 else:
@@ -184,6 +181,7 b' class hgwebdir(object):'
184 yield {"type" : i[0], "extension": i[1],
181 yield {"type" : i[0], "extension": i[1],
185 "node": nodeid, "url": url}
182 "node": nodeid, "url": url}
186
183
184 sortdefault = 'name', False
187 def entries(sortcolumn="", descending=False, subdir="", **map):
185 def entries(sortcolumn="", descending=False, subdir="", **map):
188 rows = []
186 rows = []
189 parity = paritygen(self.stripecount)
187 parity = paritygen(self.stripecount)
@@ -233,8 +231,7 b' class hgwebdir(object):'
233 lastchange=d,
231 lastchange=d,
234 lastchange_sort=d[1]-d[0],
232 lastchange_sort=d[1]-d[0],
235 archives=archivelist(u, "tip", url))
233 archives=archivelist(u, "tip", url))
236 if (not sortcolumn
234 if (not sortcolumn or (sortcolumn, descending) == sortdefault):
237 or (sortcolumn, descending) == self.repos_sorted):
238 # fast path for unsorted output
235 # fast path for unsorted output
239 row['parity'] = parity.next()
236 row['parity'] = parity.next()
240 yield row
237 yield row
@@ -249,7 +246,7 b' class hgwebdir(object):'
249 yield row
246 yield row
250
247
251 sortable = ["name", "description", "contact", "lastchange"]
248 sortable = ["name", "description", "contact", "lastchange"]
252 sortcolumn, descending = self.repos_sorted
249 sortcolumn, descending = sortdefault
253 if 'sort' in req.form:
250 if 'sort' in req.form:
254 sortcolumn = req.form['sort'][0]
251 sortcolumn = req.form['sort'][0]
255 descending = sortcolumn.startswith('-')
252 descending = sortcolumn.startswith('-')
General Comments 0
You need to be logged in to leave comments. Login now