# HG changeset patch # User Pierre-Yves David # Date 2013-01-14 15:55:48 # Node ID f332a64fef517ff800416bb79fd4764fa3fc4903 # Parent 50dc5b244474036b2b845f3b6f76a44fc1f17fb8 hgweb: introduction a filerevnav subclass It'll be use to implement the file specific behavior. diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -772,7 +772,7 @@ def filelog(web, req, tmpl): yield e nodefunc = lambda x: fctx.filectx(fileid=x) - nav = webutil.revnav(nodefunc).gen(end - 1, revcount, count) + nav = webutil.filerevnav(nodefunc).gen(end - 1, revcount, count) return tmpl("filelog", file=f, node=fctx.hex(), nav=nav, entries=lambda **x: entries(latestonly=False, **x), latestentry=lambda **x: entries(latestonly=True, **x), diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -93,6 +93,9 @@ class revnav(object): return ({'before': lambda **map: (data(i) for i in navbefore), 'after': lambda **map: (data(i) for i in navafter)},) +class filerevnav(revnav): + pass + def _siblings(siblings=[], hiderev=None): siblings = [s for s in siblings if s.node() != nullid] if len(siblings) == 1 and siblings[0].rev() == hiderev: