Patchwork [17,of,23,Series-D] hgweb: simplify addition of "(0) navigation entry"

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 11, 2013, 12:24 a.m.
Message ID <26352d17c13b7bf4bc74.1357863842@yamac.lan>
Download mbox | patch
Permalink /patch/556/
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 1357841372 -3600
# Node ID 26352d17c13b7bf4bc743bdd6e96704fca644a86
# Parent  b5c4fbe18ffe6569402ece22b1273bc4a46b6f44
hgweb: simplify addition of "(0) navigation entry"

Patch

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -74,11 +74,11 @@  class revnav(object):
         """
         if not self:
             # empty repo
             return ({'before': (), 'after': ()},)
 
-        navbefore = []
+        navbefore = [("(0)", self.hex(0))]
         navafter = []
 
         for f in _navseq(1, pagelen):
             if f > limit:
                 break
@@ -86,11 +86,10 @@  class revnav(object):
                 navafter.append(("+%d" % f, self.hex(pos + f)))
             if pos - f >= 0:
                 navbefore.insert(0, ("-%d" % f, self.hex(pos - f)))
 
         navafter.append(("tip", "tip"))
-        navbefore.insert(0, ("(0)", self.hex(0)))
 
         def gen(l):
             def f(**map):
                 return ({"label": i[0], "node": i[1]} for i in l)
             return f