mercurial/hgweb/webcommands.py
changeset 19737 ab5442f45441
parent 19735 6907251122e3
child 19738 93b8544c4482
equal deleted inserted replaced
19736:f08e542ce918 19737:ab5442f45441
   257     elif 'rev' in req.form:
   257     elif 'rev' in req.form:
   258         return _search(web, req, tmpl)
   258         return _search(web, req, tmpl)
   259     else:
   259     else:
   260         ctx = web.repo['tip']
   260         ctx = web.repo['tip']
   261 
   261 
   262     def changelist(latestonly):
   262     def changelist():
   263         revs = []
   263         revs = []
   264         if pos != -1:
   264         if pos != -1:
   265             revs = web.repo.changelog.revs(pos, 0)
   265             revs = web.repo.changelog.revs(pos, 0)
   266         if latestonly:
       
   267             revs = (revs.next(),)
       
   268         curcount = 0
   266         curcount = 0
   269         for i in revs:
   267         for i in revs:
   270             ctx = web.repo[i]
   268             ctx = web.repo[i]
   271             n = ctx.node()
   269             n = ctx.node()
   272             showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
   270             showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
   307     pos = ctx.rev()
   305     pos = ctx.rev()
   308     parity = paritygen(web.stripecount)
   306     parity = paritygen(web.stripecount)
   309 
   307 
   310     changenav = webutil.revnav(web.repo).gen(pos, revcount, count)
   308     changenav = webutil.revnav(web.repo).gen(pos, revcount, count)
   311 
   309 
       
   310     entries = list(changelist())
       
   311     latestentry = entries[:1]
       
   312 
   312     return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav,
   313     return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav,
   313                 node=ctx.hex(), rev=pos, changesets=count,
   314                 node=ctx.hex(), rev=pos, changesets=count,
   314                 entries=lambda **x: changelist(latestonly=False),
   315                 entries=entries,
   315                 latestentry=lambda **x: changelist(latestonly=True),
   316                 latestentry=latestentry,
   316                 archives=web.archivelist("tip"), revcount=revcount,
   317                 archives=web.archivelist("tip"), revcount=revcount,
   317                 morevars=morevars, lessvars=lessvars, query=query)
   318                 morevars=morevars, lessvars=lessvars, query=query)
   318 
   319 
   319 def shortlog(web, req, tmpl):
   320 def shortlog(web, req, tmpl):
   320     return changelog(web, req, tmpl, shortlog = True)
   321     return changelog(web, req, tmpl, shortlog = True)