##// END OF EJS Templates
hgweb: add less/more links for search logs (issue1972)
Dirkjan Ochtman -
r10247:e8c74103 default
parent child Browse files
Show More
@@ -98,7 +98,20 b' def file(web, req, tmpl):'
98 except ErrorResponse:
98 except ErrorResponse:
99 raise inst
99 raise inst
100
100
101 def _search(web, tmpl, query):
101 def _search(web, req, tmpl):
102
103 query = req.form['rev'][0]
104 revcount = web.maxchanges
105 if 'revcount' in req.form:
106 revcount = int(req.form.get('revcount', [revcount])[0])
107 tmpl.defaults['sessionvars']['revcount'] = revcount
108
109 lessvars = copy.copy(tmpl.defaults['sessionvars'])
110 lessvars['revcount'] = revcount / 2
111 lessvars['rev'] = query
112 morevars = copy.copy(tmpl.defaults['sessionvars'])
113 morevars['revcount'] = revcount * 2
114 morevars['rev'] = query
102
115
103 def changelist(**map):
116 def changelist(**map):
104 cl = web.repo.changelog
117 cl = web.repo.changelog
@@ -146,19 +159,18 b' def _search(web, tmpl, query):'
146 inbranch=webutil.nodeinbranch(web.repo, ctx),
159 inbranch=webutil.nodeinbranch(web.repo, ctx),
147 branches=webutil.nodebranchdict(web.repo, ctx))
160 branches=webutil.nodebranchdict(web.repo, ctx))
148
161
149 if count >= web.maxchanges:
162 if count >= revcount:
150 break
163 break
151
164
152 cl = web.repo.changelog
165 cl = web.repo.changelog
153 parity = paritygen(web.stripecount)
166 parity = paritygen(web.stripecount)
154
167
155 return tmpl('search',
168 return tmpl('search', query=query, node=hex(cl.tip()),
156 query=query,
169 entries=changelist, archives=web.archivelist("tip"),
157 node=hex(cl.tip()),
170 morevars=morevars, lessvars=lessvars)
158 entries=changelist,
159 archives=web.archivelist("tip"))
160
171
161 def changelog(web, req, tmpl, shortlog = False):
172 def changelog(web, req, tmpl, shortlog=False):
173
162 if 'node' in req.form:
174 if 'node' in req.form:
163 ctx = webutil.changectx(web.repo, req)
175 ctx = webutil.changectx(web.repo, req)
164 else:
176 else:
@@ -169,7 +181,7 b' def changelog(web, req, tmpl, shortlog ='
169 try:
181 try:
170 ctx = web.repo[hi]
182 ctx = web.repo[hi]
171 except error.RepoError:
183 except error.RepoError:
172 return _search(web, tmpl, hi) # XXX redirect to 404 page?
184 return _search(web, req, tmpl) # XXX redirect to 404 page?
173
185
174 def changelist(limit=0, **map):
186 def changelist(limit=0, **map):
175 l = [] # build a list in forward order for efficiency
187 l = [] # build a list in forward order for efficiency
@@ -28,6 +28,11 b''
28 files, or words in the commit message</div>
28 files, or words in the commit message</div>
29 </form>
29 </form>
30
30
31 <div class="navigate">
32 <a href="{url}search/{lessvars%urlparameter}">less</a>
33 <a href="{url}search/{morevars%urlparameter}">more</a>
34 </div>
35
31 <table class="bigtable">
36 <table class="bigtable">
32 <tr>
37 <tr>
33 <th class="age">age</th>
38 <th class="age">age</th>
@@ -37,6 +42,11 b' files, or words in the commit message</d'
37 {entries}
42 {entries}
38 </table>
43 </table>
39
44
45 <div class="navigate">
46 <a href="{url}search/{lessvars%urlparameter}">less</a>
47 <a href="{url}search/{morevars%urlparameter}">more</a>
48 </div>
49
40 </div>
50 </div>
41 </div>
51 </div>
42
52
General Comments 0
You need to be logged in to leave comments. Login now