##// END OF EJS Templates
hgweb: pass nodefunc to the revnav object...
Pierre-Yves David -
r18404:1da84a6b default
parent child Browse files
Show More
@@ -242,7 +242,7 b' def changelog(web, req, tmpl, shortlog=F'
242 242 pos = end - 1
243 243 parity = paritygen(web.stripecount, offset=start - end)
244 244
245 changenav = webutil.revnav().gen(pos, revcount, count, web.repo.changectx)
245 changenav = webutil.revnav(web.repo.changectx).gen(pos, revcount, count)
246 246
247 247 return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav,
248 248 node=ctx.hex(), rev=pos, changesets=count,
@@ -772,7 +772,7 b' def filelog(web, req, tmpl):'
772 772 yield e
773 773
774 774 nodefunc = lambda x: fctx.filectx(fileid=x)
775 nav = webutil.revnav().gen(end - 1, revcount, count, nodefunc)
775 nav = webutil.revnav(nodefunc).gen(end - 1, revcount, count)
776 776 return tmpl("filelog", file=f, node=fctx.hex(), nav=nav,
777 777 entries=lambda **x: entries(latestonly=False, **x),
778 778 latestentry=lambda **x: entries(latestonly=True, **x),
@@ -851,7 +851,7 b' def graph(web, req, tmpl):'
851 851
852 852 uprev = min(max(0, count - 1), rev + revcount)
853 853 downrev = max(0, rev - revcount)
854 changenav = webutil.revnav().gen(pos, revcount, count, web.repo.changectx)
854 changenav = webutil.revnav(web.repo.changectx).gen(pos, revcount, count)
855 855
856 856 dag = graphmod.dagwalker(web.repo, range(start, end)[::-1])
857 857 tree = list(graphmod.colored(dag, web.repo))
@@ -41,13 +41,19 b' def _navseq(step, firststep=None):'
41 41
42 42 class revnav(object):
43 43
44 def gen(self, pos, pagelen, limit, nodefunc):
44 def __init__(self, nodefunc):
45 """Navigation generation object
46
47 :nodefun: factory for a changectx from a revision
48 """
49 self.nodefunc = nodefunc
50
51 def gen(self, pos, pagelen, limit):
45 52 """computes label and revision id for navigation link
46 53
47 54 :pos: is the revision relative to which we generate navigation.
48 55 :pagelen: the size of each navigation page
49 56 :limit: how far shall we link
50 :nodefun: factory for a changectx from a revision
51 57
52 58 The return is:
53 59 - a single element tuple
@@ -63,13 +69,15 b' class revnav(object):'
63 69 if f > limit:
64 70 break
65 71 if pos + f < limit:
66 navafter.append(("+%d" % f, hex(nodefunc(pos + f).node())))
72 navafter.append(("+%d" % f,
73 hex(self.nodefunc(pos + f).node())))
67 74 if pos - f >= 0:
68 navbefore.insert(0, ("-%d" % f, hex(nodefunc(pos - f).node())))
75 navbefore.insert(0, ("-%d" % f,
76 hex(self.nodefunc(pos - f).node())))
69 77
70 78 navafter.append(("tip", "tip"))
71 79 try:
72 navbefore.insert(0, ("(0)", hex(nodefunc(0).node())))
80 navbefore.insert(0, ("(0)", hex(self.nodefunc(0).node())))
73 81 except error.RepoError:
74 82 pass
75 83
General Comments 0
You need to be logged in to leave comments. Login now