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

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 16, 2013, 1:32 p.m.
Message ID <f7524a4f3cf5e4b10ba3.1358343135@crater2.logilab.fr>
Download mbox | patch
Permalink /patch/646/
State Accepted
Commit f332a64fef517ff800416bb79fd4764fa3fc4903
Delegated to: Kevin Bullock
Headers show

Comments

Pierre-Yves David - Jan. 16, 2013, 1:32 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

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: