Show More
@@ -1010,8 +1010,10 b' class hgwebdir(object):' | |||||
1010 | return [(name.strip(os.sep), path) for name, path in items] |
|
1010 | return [(name.strip(os.sep), path) for name, path in items] | |
1011 |
|
1011 | |||
1012 | self.motd = "" |
|
1012 | self.motd = "" | |
|
1013 | self.repos_sorted = ('name', False) | |||
1013 | if isinstance(config, (list, tuple)): |
|
1014 | if isinstance(config, (list, tuple)): | |
1014 | self.repos = cleannames(config) |
|
1015 | self.repos = cleannames(config) | |
|
1016 | self.repos_sorted = ('', False) | |||
1015 | elif isinstance(config, dict): |
|
1017 | elif isinstance(config, dict): | |
1016 | self.repos = cleannames(config.items()) |
|
1018 | self.repos = cleannames(config.items()) | |
1017 | self.repos.sort() |
|
1019 | self.repos.sort() | |
@@ -1078,14 +1080,15 b' class hgwebdir(object):' | |||||
1078 | row = dict(contact=contact or "unknown", |
|
1080 | row = dict(contact=contact or "unknown", | |
1079 | contact_sort=contact.upper() or "unknown", |
|
1081 | contact_sort=contact.upper() or "unknown", | |
1080 | name=name, |
|
1082 | name=name, | |
1081 |
name_sort=name |
|
1083 | name_sort=name, | |
1082 | url=url, |
|
1084 | url=url, | |
1083 | description=description or "unknown", |
|
1085 | description=description or "unknown", | |
1084 | description_sort=description.upper() or "unknown", |
|
1086 | description_sort=description.upper() or "unknown", | |
1085 | lastchange=d, |
|
1087 | lastchange=d, | |
1086 | lastchange_sort=d[1]-d[0], |
|
1088 | lastchange_sort=d[1]-d[0], | |
1087 | archives=archivelist(u, "tip", url)) |
|
1089 | archives=archivelist(u, "tip", url)) | |
1088 |
if not sortcolumn |
|
1090 | if (not sortcolumn | |
|
1091 | or (sortcolumn, descending) == self.repos_sorted): | |||
1089 | # fast path for unsorted output |
|
1092 | # fast path for unsorted output | |
1090 | row['parity'] = parity |
|
1093 | row['parity'] = parity | |
1091 | parity = 1 - parity |
|
1094 | parity = 1 - parity | |
@@ -1121,14 +1124,14 b' class hgwebdir(object):' | |||||
1121 | or tmpl("error", error="%r not found" % fname)) |
|
1124 | or tmpl("error", error="%r not found" % fname)) | |
1122 | else: |
|
1125 | else: | |
1123 | sortable = ["name", "description", "contact", "lastchange"] |
|
1126 | sortable = ["name", "description", "contact", "lastchange"] | |
1124 |
sortcolumn = |
|
1127 | sortcolumn, descending = self.repos_sorted | |
1125 | if req.form.has_key('sort'): |
|
1128 | if req.form.has_key('sort'): | |
1126 | sortcolumn = req.form['sort'][0] |
|
1129 | sortcolumn = req.form['sort'][0] | |
1127 | descending = sortcolumn.startswith('-') |
|
1130 | descending = sortcolumn.startswith('-') | |
1128 | if descending: |
|
1131 | if descending: | |
1129 | sortcolumn = sortcolumn[1:] |
|
1132 | sortcolumn = sortcolumn[1:] | |
1130 | if sortcolumn not in sortable: |
|
1133 | if sortcolumn not in sortable: | |
1131 | sortcolumn = "" |
|
1134 | sortcolumn = "" | |
1132 |
|
1135 | |||
1133 | sort = [("sort_%s" % column, |
|
1136 | sort = [("sort_%s" % column, | |
1134 | "%s%s" % ((not descending and column == sortcolumn) |
|
1137 | "%s%s" % ((not descending and column == sortcolumn) |
General Comments 0
You need to be logged in to leave comments.
Login now