Patchwork [13,of,22,V2-Series-D] hgweb: introduction a filerevnav subclass

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 14, 2013, 8:35 p.m.
Message ID <ac76bc6f90545c3252d8.1358195745@yamac.lan>
Download mbox | patch
Permalink /patch/609/
State Superseded
Commit f332a64fef517ff800416bb79fd4764fa3fc4903
Headers show

Comments

Pierre-Yves David - Jan. 14, 2013, 8:35 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1358178948 -3600
# Node ID ac76bc6f90545c3252d8cc1e8109e75de22aea4c
# Parent  75411d4dff69489836952e07684d4c2c764f9569
hgweb: introduction a filerevnav subclass

It'll be use to implement the file specific behavior.

Patch

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: