Patchwork [12,of,22,V2-Series-D] hgweb: simplify addition of "(0) navigation entry"

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 14, 2013, 8:35 p.m.
Message ID <75411d4dff6948983695.1358195744@yamac.lan>
Download mbox | patch
Permalink /patch/608/
State Superseded
Commit 50dc5b244474036b2b845f3b6f76a44fc1f17fb8
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 1357841372 -3600
# Node ID 75411d4dff69489836952e07684d4c2c764f9569
# Parent  7c099354cf34345f6ac010408edacf15d86e4ae9
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)))
 
         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)},)