[PATCH 18 of 23 Series-D] hgweb: introduction a filrevnav subclass
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Fri Jan 11 00:24:03 UTC 2013
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at 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.
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:
More information about the Mercurial-devel
mailing list