Patchwork [18,of,23,Series-D] hgweb: introduction a filrevnav subclass

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 11, 2013, 12:24 a.m.
Message ID <850d6883d0c2c856ca66.1357863843@yamac.lan>
Download mbox | patch
Permalink /patch/536/
State Superseded
Headers show

Comments

Pierre-Yves David - Jan. 11, 2013, 12:24 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1357841581 -3600
# Node ID 850d6883d0c2c856ca663ee7053c0cc8e0f85688
# Parent  26352d17c13b7bf4bc743bdd6e96704fca644a86
hgweb: introduction a filrevnav 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
@@ -774,11 +774,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(**x),
                 latestentry=lambda **x: entries(lastest=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
@@ -95,10 +95,13 @@  class revnav(object):
             return f
 
         return ({'before':gen(navbefore),
                  'after': gen(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: