[PATCH 09 of 15 V3] hgweb: introduction a filerevnav subclass

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Wed Jan 16 07:32:15 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1358178948 -3600
# Node ID f7524a4f3cf5e4b10ba35aa9ecd0264ea243632f
# Parent  fe1516c451db3f9f25c5cbc258fe0d4ba07f5c63
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
@@ -770,11 +770,11 @@ def filelog(web, req, tmpl):
                       "branches": webutil.nodebranchdict(repo, iterfctx)})
         for e in reversed(l):
             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),
                 revcount=revcount, morevars=morevars, lessvars=lessvars)
 
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -91,10 +91,13 @@ class revnav(object):
 
         data = lambda i: {"label": i[0], "node": i[1]}
         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:
         return
     for s in siblings:


More information about the Mercurial-devel mailing list