mercurial/hgweb/webcommands.py
changeset 20022 d85dfe211c71
parent 20021 4830763f825c
child 20023 2771e59afac4
equal deleted inserted replaced
20021:4830763f825c 20022:d85dfe211c71
   834     count = fctx.filerev() + 1
   834     count = fctx.filerev() + 1
   835     start = max(0, fctx.filerev() - revcount + 1) # first rev on this page
   835     start = max(0, fctx.filerev() - revcount + 1) # first rev on this page
   836     end = min(count, start + revcount) # last rev on this page
   836     end = min(count, start + revcount) # last rev on this page
   837     parity = paritygen(web.stripecount, offset=start - end)
   837     parity = paritygen(web.stripecount, offset=start - end)
   838 
   838 
   839     def entries(latestonly):
   839     def entries():
   840         l = []
   840         l = []
   841 
   841 
   842         repo = web.repo
   842         repo = web.repo
   843         revs = repo.changelog.revs(start, end - 1)
   843         revs = repo.changelog.revs(start, end - 1)
   844         if latestonly:
       
   845             for r in revs:
       
   846                 pass
       
   847             revs = (r,)
       
   848         for i in revs:
   844         for i in revs:
   849             iterfctx = fctx.filectx(i)
   845             iterfctx = fctx.filectx(i)
   850 
   846 
   851             l.append({"parity": parity.next(),
   847             l.append({"parity": parity.next(),
   852                       "filerev": i,
   848                       "filerev": i,
   866                       "inbranch": webutil.nodeinbranch(repo, iterfctx),
   862                       "inbranch": webutil.nodeinbranch(repo, iterfctx),
   867                       "branches": webutil.nodebranchdict(repo, iterfctx)})
   863                       "branches": webutil.nodebranchdict(repo, iterfctx)})
   868         for e in reversed(l):
   864         for e in reversed(l):
   869             yield e
   865             yield e
   870 
   866 
       
   867     entries = list(entries())
       
   868     latestentry = entries[:1]
       
   869 
   871     revnav = webutil.filerevnav(web.repo, fctx.path())
   870     revnav = webutil.filerevnav(web.repo, fctx.path())
   872     nav = revnav.gen(end - 1, revcount, count)
   871     nav = revnav.gen(end - 1, revcount, count)
   873     return tmpl("filelog", file=f, node=fctx.hex(), nav=nav,
   872     return tmpl("filelog", file=f, node=fctx.hex(), nav=nav,
   874                 entries=lambda **x: entries(latestonly=False),
   873                 entries=entries,
   875                 latestentry=lambda **x: entries(latestonly=True),
   874                 latestentry=latestentry,
   876                 revcount=revcount, morevars=morevars, lessvars=lessvars)
   875                 revcount=revcount, morevars=morevars, lessvars=lessvars)
   877 
   876 
   878 def archive(web, req, tmpl):
   877 def archive(web, req, tmpl):
   879     type_ = req.form.get('type', [None])[0]
   878     type_ = req.form.get('type', [None])[0]
   880     allowed = web.configlist("web", "allow_archive")
   879     allowed = web.configlist("web", "allow_archive")