# HG changeset patch # User Alexander Plavin # Date 2013-09-06 09:30:57 # Node ID 93b8544c4482e84a662429942153c5b6adb77147 # Parent ab5442f45441b055650e90aa13167ff47df66161 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) diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -271,7 +271,7 @@ def changelog(web, req, tmpl, shortlog=F files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) curcount += 1 - if curcount > revcount: + if curcount > revcount + 1: break yield {"parity": parity.next(), "author": ctx.user(), @@ -309,11 +309,16 @@ def changelog(web, req, tmpl, shortlog=F entries = list(changelist()) latestentry = entries[:1] + if len(entries) > revcount: + nextentry = entries[-1:] + entries = entries[:-1] + else: + nextentry = [] return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav, node=ctx.hex(), rev=pos, changesets=count, entries=entries, - latestentry=latestentry, + latestentry=latestentry, nextentry=nextentry, archives=web.archivelist("tip"), revcount=revcount, morevars=morevars, lessvars=lessvars, query=query)