comparison mercurial/hgweb/webcommands.py @ 18409:e3f5cef11d6a

hgweb: pass repo object to revnav construction For compatibility with changelog filtering we need access to the changelog, a simple nodefunc is not sufficient, only the changelog and repo have access the filteredrevs information. For the filerevnav version, we use an unfiltered changelog. Linkrev is currently broken with filtering and we need some failsafe to prevent traceback. This is the same approach as the one used in 518c1403838f. The use of filectx.changectx() allowed the previous code to use the 518c1403838f hack. This changeset may result in an incorrect behaviors, Navigation link may point to missing revision. However this bad navigation generation is much better than a plain crash
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 16 Jan 2013 13:18:22 +0100
parents f332a64fef51
children 56ca4443a343
comparison
equal deleted inserted replaced
18408:f332a64fef51 18409:e3f5cef11d6a
240 start = max(0, pos - revcount + 1) 240 start = max(0, pos - revcount + 1)
241 end = min(count, start + revcount) 241 end = min(count, start + revcount)
242 pos = end - 1 242 pos = end - 1
243 parity = paritygen(web.stripecount, offset=start - end) 243 parity = paritygen(web.stripecount, offset=start - end)
244 244
245 changenav = webutil.revnav(web.repo.changectx).gen(pos, revcount, count) 245 changenav = webutil.revnav(web.repo).gen(pos, revcount, count)
246 246
247 return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav, 247 return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav,
248 node=ctx.hex(), rev=pos, changesets=count, 248 node=ctx.hex(), rev=pos, changesets=count,
249 entries=lambda **x: changelist(latestonly=False, **x), 249 entries=lambda **x: changelist(latestonly=False, **x),
250 latestentry=lambda **x: changelist(latestonly=True, **x), 250 latestentry=lambda **x: changelist(latestonly=True, **x),
769 "inbranch": webutil.nodeinbranch(repo, iterfctx), 769 "inbranch": webutil.nodeinbranch(repo, iterfctx),
770 "branches": webutil.nodebranchdict(repo, iterfctx)}) 770 "branches": webutil.nodebranchdict(repo, iterfctx)})
771 for e in reversed(l): 771 for e in reversed(l):
772 yield e 772 yield e
773 773
774 nodefunc = lambda x: fctx.filectx(fileid=x) 774 revnav = webutil.filerevnav(web.repo, fctx.path())
775 nav = webutil.filerevnav(nodefunc).gen(end - 1, revcount, count) 775 nav = revnav.gen(end - 1, revcount, count)
776 return tmpl("filelog", file=f, node=fctx.hex(), nav=nav, 776 return tmpl("filelog", file=f, node=fctx.hex(), nav=nav,
777 entries=lambda **x: entries(latestonly=False, **x), 777 entries=lambda **x: entries(latestonly=False, **x),
778 latestentry=lambda **x: entries(latestonly=True, **x), 778 latestentry=lambda **x: entries(latestonly=True, **x),
779 revcount=revcount, morevars=morevars, lessvars=lessvars) 779 revcount=revcount, morevars=morevars, lessvars=lessvars)
780 780
849 end = min(count, start + revcount) 849 end = min(count, start + revcount)
850 pos = end - 1 850 pos = end - 1
851 851
852 uprev = min(max(0, count - 1), rev + revcount) 852 uprev = min(max(0, count - 1), rev + revcount)
853 downrev = max(0, rev - revcount) 853 downrev = max(0, rev - revcount)
854 changenav = webutil.revnav(web.repo.changectx).gen(pos, revcount, count) 854 changenav = webutil.revnav(web.repo).gen(pos, revcount, count)
855 855
856 dag = graphmod.dagwalker(web.repo, range(start, end)[::-1]) 856 dag = graphmod.dagwalker(web.repo, range(start, end)[::-1])
857 tree = list(graphmod.colored(dag, web.repo)) 857 tree = list(graphmod.colored(dag, web.repo))
858 858
859 def getcolumns(tree): 859 def getcolumns(tree):