##// END OF EJS Templates
hgweb: add less/more links to shortlog/filelog nav
Dirkjan Ochtman -
r10246:b9d02695 default
parent child Browse files
Show More
@@ -200,24 +200,32 b' def changelog(web, req, tmpl, shortlog ='
200 for e in l:
200 for e in l:
201 yield e
201 yield e
202
202
203 maxchanges = shortlog and web.maxshortchanges or web.maxchanges
203 revcount = shortlog and web.maxshortchanges or web.maxchanges
204 if 'revcount' in req.form:
205 revcount = int(req.form.get('revcount', [revcount])[0])
206 tmpl.defaults['sessionvars']['revcount'] = revcount
207
208 lessvars = copy.copy(tmpl.defaults['sessionvars'])
209 lessvars['revcount'] = revcount / 2
210 morevars = copy.copy(tmpl.defaults['sessionvars'])
211 morevars['revcount'] = revcount * 2
212
204 cl = web.repo.changelog
213 cl = web.repo.changelog
205 count = len(cl)
214 count = len(cl)
206 pos = ctx.rev()
215 pos = ctx.rev()
207 start = max(0, pos - maxchanges + 1)
216 start = max(0, pos - revcount + 1)
208 end = min(count, start + maxchanges)
217 end = min(count, start + revcount)
209 pos = end - 1
218 pos = end - 1
210 parity = paritygen(web.stripecount, offset=start-end)
219 parity = paritygen(web.stripecount, offset=start-end)
211
220
212 changenav = webutil.revnavgen(pos, maxchanges, count, web.repo.changectx)
221 changenav = webutil.revnavgen(pos, revcount, count, web.repo.changectx)
213
222
214 return tmpl(shortlog and 'shortlog' or 'changelog',
223 return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav,
215 changenav=changenav,
224 node=hex(ctx.node()), rev=pos, changesets=count,
216 node=hex(ctx.node()),
217 rev=pos, changesets=count,
218 entries=lambda **x: changelist(limit=0,**x),
225 entries=lambda **x: changelist(limit=0,**x),
219 latestentry=lambda **x: changelist(limit=1,**x),
226 latestentry=lambda **x: changelist(limit=1,**x),
220 archives=web.archivelist("tip"))
227 archives=web.archivelist("tip"), revcount=revcount,
228 morevars=morevars, lessvars=lessvars)
221
229
222 def shortlog(web, req, tmpl):
230 def shortlog(web, req, tmpl):
223 return changelog(web, req, tmpl, shortlog = True)
231 return changelog(web, req, tmpl, shortlog = True)
@@ -567,10 +575,19 b' def filelog(web, req, tmpl):'
567 frev -= 1
575 frev -= 1
568 fctx = web.repo.filectx(f, fl.linkrev(frev))
576 fctx = web.repo.filectx(f, fl.linkrev(frev))
569
577
578 revcount = web.maxshortchanges
579 if 'revcount' in req.form:
580 revcount = int(req.form.get('revcount', [revcount])[0])
581 tmpl.defaults['sessionvars']['revcount'] = revcount
582
583 lessvars = copy.copy(tmpl.defaults['sessionvars'])
584 lessvars['revcount'] = revcount / 2
585 morevars = copy.copy(tmpl.defaults['sessionvars'])
586 morevars['revcount'] = revcount * 2
587
570 count = fctx.filerev() + 1
588 count = fctx.filerev() + 1
571 pagelen = web.maxshortchanges
589 start = max(0, fctx.filerev() - revcount + 1) # first rev on this page
572 start = max(0, fctx.filerev() - pagelen + 1) # first rev on this page
590 end = min(count, start + revcount) # last rev on this page
573 end = min(count, start + pagelen) # last rev on this page
574 parity = paritygen(web.stripecount, offset=start-end)
591 parity = paritygen(web.stripecount, offset=start-end)
575
592
576 def entries(limit=0, **map):
593 def entries(limit=0, **map):
@@ -602,11 +619,11 b' def filelog(web, req, tmpl):'
602 yield e
619 yield e
603
620
604 nodefunc = lambda x: fctx.filectx(fileid=x)
621 nodefunc = lambda x: fctx.filectx(fileid=x)
605 nav = webutil.revnavgen(end - 1, pagelen, count, nodefunc)
622 nav = webutil.revnavgen(end - 1, revcount, count, nodefunc)
606 return tmpl("filelog", file=f, node=hex(fctx.node()), nav=nav,
623 return tmpl("filelog", file=f, node=hex(fctx.node()), nav=nav,
607 entries=lambda **x: entries(limit=0, **x),
624 entries=lambda **x: entries(limit=0, **x),
608 latestentry=lambda **x: entries(limit=1, **x))
625 latestentry=lambda **x: entries(limit=1, **x),
609
626 revcount=revcount, morevars=morevars, lessvars=lessvars)
610
627
611 def archive(web, req, tmpl):
628 def archive(web, req, tmpl):
612 type_ = req.form.get('type', [None])[0]
629 type_ = req.form.get('type', [None])[0]
@@ -43,7 +43,10 b''
43 files, or words in the commit message</div>
43 files, or words in the commit message</div>
44 </form>
44 </form>
45
45
46 <div class="navigate">{nav%filenaventry}</div>
46 <div class="navigate">
47 <a href="{url}log/{node|short}/{file|urlescape}{lessvars%urlparameter}">less</a>
48 <a href="{url}log/{node|short}/{file|urlescape}{morevars%urlparameter}">more</a>
49 | {nav%filenaventry}</div>
47
50
48 <table class="bigtable">
51 <table class="bigtable">
49 <tr>
52 <tr>
@@ -54,6 +57,12 b' files, or words in the commit message</d'
54 {entries%filelogentry}
57 {entries%filelogentry}
55 </table>
58 </table>
56
59
60 <div class="navigate">
61 <a href="{url}log/{node|short}/{file|urlescape}{lessvars%urlparameter}">less</a>
62 <a href="{url}log/{node|short}/{file|urlescape}{morevars%urlparameter}">more</a>
63 | {nav%filenaventry}
64 </div>
65
57 </div>
66 </div>
58 </div>
67 </div>
59
68
@@ -39,7 +39,11 b''
39 files, or words in the commit message</div>
39 files, or words in the commit message</div>
40 </form>
40 </form>
41
41
42 <div class="navigate">rev {rev}: {changenav%navshortentry}</div>
42 <div class="navigate">
43 <a href="{url}shortlog/{rev}{lessvars%urlparameter}">less</a>
44 <a href="{url}shortlog/{rev}{morevars%urlparameter}">more</a>
45 | rev {rev}: {changenav%navshortentry}
46 </div>
43
47
44 <table class="bigtable">
48 <table class="bigtable">
45 <tr>
49 <tr>
@@ -50,7 +54,12 b' files, or words in the commit message</d'
50 {entries%shortlogentry}
54 {entries%shortlogentry}
51 </table>
55 </table>
52
56
53 <div class="navigate">rev {rev}: {changenav%navshortentry}</div>
57 <div class="navigate">
58 <a href="{url}shortlog/{rev}{lessvars%urlparameter}">less</a>
59 <a href="{url}shortlog/{rev}{morevars%urlparameter}">more</a>
60 | rev {rev}: {changenav%navshortentry}
61 </div>
62
54 </div>
63 </div>
55 </div>
64 </div>
56
65
@@ -201,7 +201,11 b' 200 Script output follows'
201 files, or words in the commit message</div>
201 files, or words in the commit message</div>
202 </form>
202 </form>
203
203
204 <div class="navigate">rev 2: <a href="/shortlog/2ef0ac749a14">(0)</a> <a href="/shortlog/tip">tip</a> </div>
204 <div class="navigate">
205 <a href="/shortlog/2?revcount=30">less</a>
206 <a href="/shortlog/2?revcount=120">more</a>
207 | rev 2: <a href="/shortlog/2ef0ac749a14">(0)</a> <a href="/shortlog/tip">tip</a>
208 </div>
205
209
206 <table class="bigtable">
210 <table class="bigtable">
207 <tr>
211 <tr>
@@ -227,7 +231,12 b' files, or words in the commit message</d'
227
231
228 </table>
232 </table>
229
233
230 <div class="navigate">rev 2: <a href="/shortlog/2ef0ac749a14">(0)</a> <a href="/shortlog/tip">tip</a> </div>
234 <div class="navigate">
235 <a href="/shortlog/2?revcount=30">less</a>
236 <a href="/shortlog/2?revcount=120">more</a>
237 | rev 2: <a href="/shortlog/2ef0ac749a14">(0)</a> <a href="/shortlog/tip">tip</a>
238 </div>
239
231 </div>
240 </div>
232 </div>
241 </div>
233
242
@@ -47,7 +47,11 b' 200 Script output follows'
47 files, or words in the commit message</div>
47 files, or words in the commit message</div>
48 </form>
48 </form>
49
49
50 <div class="navigate">rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a> </div>
50 <div class="navigate">
51 <a href="/shortlog/-1?revcount=30">less</a>
52 <a href="/shortlog/-1?revcount=120">more</a>
53 | rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a>
54 </div>
51
55
52 <table class="bigtable">
56 <table class="bigtable">
53 <tr>
57 <tr>
@@ -58,7 +62,12 b' files, or words in the commit message</d'
58
62
59 </table>
63 </table>
60
64
61 <div class="navigate">rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a> </div>
65 <div class="navigate">
66 <a href="/shortlog/-1?revcount=30">less</a>
67 <a href="/shortlog/-1?revcount=120">more</a>
68 | rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a>
69 </div>
70
62 </div>
71 </div>
63 </div>
72 </div>
64
73
@@ -116,7 +125,11 b' 200 Script output follows'
116 files, or words in the commit message</div>
125 files, or words in the commit message</div>
117 </form>
126 </form>
118
127
119 <div class="navigate">rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a> </div>
128 <div class="navigate">
129 <a href="/shortlog/-1?revcount=5">less</a>
130 <a href="/shortlog/-1?revcount=20">more</a>
131 | rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a>
132 </div>
120
133
121 <table class="bigtable">
134 <table class="bigtable">
122 <tr>
135 <tr>
@@ -127,7 +140,12 b' files, or words in the commit message</d'
127
140
128 </table>
141 </table>
129
142
130 <div class="navigate">rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a> </div>
143 <div class="navigate">
144 <a href="/shortlog/-1?revcount=5">less</a>
145 <a href="/shortlog/-1?revcount=20">more</a>
146 | rev -1: <a href="/shortlog/000000000000">(0)</a> <a href="/shortlog/tip">tip</a>
147 </div>
148
131 </div>
149 </div>
132 </div>
150 </div>
133
151
@@ -139,7 +139,10 b' 200 Script output follows'
139 files, or words in the commit message</div>
139 files, or words in the commit message</div>
140 </form>
140 </form>
141
141
142 <div class="navigate"><a href="/log/5ed941583260/a">(0)</a> <a href="/log/tip/a">tip</a> </div>
142 <div class="navigate">
143 <a href="/log/01de2d66a28d/a?revcount=30">less</a>
144 <a href="/log/01de2d66a28d/a?revcount=120">more</a>
145 | <a href="/log/5ed941583260/a">(0)</a> <a href="/log/tip/a">tip</a> </div>
143
146
144 <table class="bigtable">
147 <table class="bigtable">
145 <tr>
148 <tr>
@@ -160,6 +163,12 b' files, or words in the commit message</d'
160
163
161 </table>
164 </table>
162
165
166 <div class="navigate">
167 <a href="/log/01de2d66a28d/a?revcount=30">less</a>
168 <a href="/log/01de2d66a28d/a?revcount=120">more</a>
169 | <a href="/log/5ed941583260/a">(0)</a> <a href="/log/tip/a">tip</a>
170 </div>
171
163 </div>
172 </div>
164 </div>
173 </div>
165
174
@@ -222,7 +231,10 b' 200 Script output follows'
222 files, or words in the commit message</div>
231 files, or words in the commit message</div>
223 </form>
232 </form>
224
233
225 <div class="navigate"><a href="/log/5ed941583260/a">(0)</a> <a href="/log/tip/a">tip</a> </div>
234 <div class="navigate">
235 <a href="/log/01de2d66a28d/a?revcount=30">less</a>
236 <a href="/log/01de2d66a28d/a?revcount=120">more</a>
237 | <a href="/log/5ed941583260/a">(0)</a> <a href="/log/tip/a">tip</a> </div>
226
238
227 <table class="bigtable">
239 <table class="bigtable">
228 <tr>
240 <tr>
@@ -243,6 +255,12 b' files, or words in the commit message</d'
243
255
244 </table>
256 </table>
245
257
258 <div class="navigate">
259 <a href="/log/01de2d66a28d/a?revcount=30">less</a>
260 <a href="/log/01de2d66a28d/a?revcount=120">more</a>
261 | <a href="/log/5ed941583260/a">(0)</a> <a href="/log/tip/a">tip</a>
262 </div>
263
246 </div>
264 </div>
247 </div>
265 </div>
248
266
@@ -305,7 +323,10 b' 200 Script output follows'
305 files, or words in the commit message</div>
323 files, or words in the commit message</div>
306 </form>
324 </form>
307
325
308 <div class="navigate"><a href="/log/5ed941583260/a">(0)</a> <a href="/log/tip/a">tip</a> </div>
326 <div class="navigate">
327 <a href="/log/5ed941583260/a?revcount=30">less</a>
328 <a href="/log/5ed941583260/a?revcount=120">more</a>
329 | <a href="/log/5ed941583260/a">(0)</a> <a href="/log/tip/a">tip</a> </div>
309
330
310 <table class="bigtable">
331 <table class="bigtable">
311 <tr>
332 <tr>
@@ -321,6 +342,12 b' files, or words in the commit message</d'
321
342
322 </table>
343 </table>
323
344
345 <div class="navigate">
346 <a href="/log/5ed941583260/a?revcount=30">less</a>
347 <a href="/log/5ed941583260/a?revcount=120">more</a>
348 | <a href="/log/5ed941583260/a">(0)</a> <a href="/log/tip/a">tip</a>
349 </div>
350
324 </div>
351 </div>
325 </div>
352 </div>
326
353
@@ -383,7 +410,10 b' 200 Script output follows'
383 files, or words in the commit message</div>
410 files, or words in the commit message</div>
384 </form>
411 </form>
385
412
386 <div class="navigate"><a href="/log/5ed941583260/a">(0)</a> <a href="/log/tip/a">tip</a> </div>
413 <div class="navigate">
414 <a href="/log/5ed941583260/a?revcount=30">less</a>
415 <a href="/log/5ed941583260/a?revcount=120">more</a>
416 | <a href="/log/5ed941583260/a">(0)</a> <a href="/log/tip/a">tip</a> </div>
387
417
388 <table class="bigtable">
418 <table class="bigtable">
389 <tr>
419 <tr>
@@ -399,6 +429,12 b' files, or words in the commit message</d'
399
429
400 </table>
430 </table>
401
431
432 <div class="navigate">
433 <a href="/log/5ed941583260/a?revcount=30">less</a>
434 <a href="/log/5ed941583260/a?revcount=120">more</a>
435 | <a href="/log/5ed941583260/a">(0)</a> <a href="/log/tip/a">tip</a>
436 </div>
437
402 </div>
438 </div>
403 </div>
439 </div>
404
440
General Comments 0
You need to be logged in to leave comments. Login now