Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/webcommands.py @ 19738:93b8544c4482
hgweb: add nextentry variable for easy pagination in changelog
nextentry always contains the first entry not shown on current page (if there is
such entry)
author | Alexander Plavin <alexander@plav.in> |
---|---|
date | Fri, 06 Sep 2013 13:30:57 +0400 |
parents | ab5442f45441 |
children | 521c373ff134 |
comparison
equal
deleted
inserted
replaced
19737:ab5442f45441 | 19738:93b8544c4482 |
---|---|
269 n = ctx.node() | 269 n = ctx.node() |
270 showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) | 270 showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) |
271 files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) | 271 files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) |
272 | 272 |
273 curcount += 1 | 273 curcount += 1 |
274 if curcount > revcount: | 274 if curcount > revcount + 1: |
275 break | 275 break |
276 yield {"parity": parity.next(), | 276 yield {"parity": parity.next(), |
277 "author": ctx.user(), | 277 "author": ctx.user(), |
278 "parent": webutil.parents(ctx, i - 1), | 278 "parent": webutil.parents(ctx, i - 1), |
279 "child": webutil.children(ctx, i + 1), | 279 "child": webutil.children(ctx, i + 1), |
307 | 307 |
308 changenav = webutil.revnav(web.repo).gen(pos, revcount, count) | 308 changenav = webutil.revnav(web.repo).gen(pos, revcount, count) |
309 | 309 |
310 entries = list(changelist()) | 310 entries = list(changelist()) |
311 latestentry = entries[:1] | 311 latestentry = entries[:1] |
312 if len(entries) > revcount: | |
313 nextentry = entries[-1:] | |
314 entries = entries[:-1] | |
315 else: | |
316 nextentry = [] | |
312 | 317 |
313 return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav, | 318 return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav, |
314 node=ctx.hex(), rev=pos, changesets=count, | 319 node=ctx.hex(), rev=pos, changesets=count, |
315 entries=entries, | 320 entries=entries, |
316 latestentry=latestentry, | 321 latestentry=latestentry, nextentry=nextentry, |
317 archives=web.archivelist("tip"), revcount=revcount, | 322 archives=web.archivelist("tip"), revcount=revcount, |
318 morevars=morevars, lessvars=lessvars, query=query) | 323 morevars=morevars, lessvars=lessvars, query=query) |
319 | 324 |
320 def shortlog(web, req, tmpl): | 325 def shortlog(web, req, tmpl): |
321 return changelog(web, req, tmpl, shortlog = True) | 326 return changelog(web, req, tmpl, shortlog = True) |