changeset 351:9525208e1c1d

hgweb: change number navigation tidy up -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hgweb: change number navigation tidy up manifest hash: 9fe0ad4fba9a7a0d4c604299024ce7732198c831 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCr+vkywK+sNU5EO8RAiOyAJ92O9ALuJTbVPPGC/x6vL6yK7GggwCgs4ta 5StdA4D/dOEUvN6O3xicKhk= =fP4C -----END PGP SIGNATURE-----
author mpm@selenic.com
date Wed, 15 Jun 2005 00:50:44 -0800
parents b4e0e20646bb
children ca39b80cbe15
files mercurial/hgweb.py
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb.py	Wed Jun 15 00:33:57 2005 -0800
+++ b/mercurial/hgweb.py	Wed Jun 15 00:50:44 2005 -0800
@@ -232,8 +232,8 @@
                 if f < self.maxchanges / 2: continue
                 if f > count: break
                 r = "%d" % f
-                if pos + f < count - (f/2): l.append(("+" + r, pos + f))
-                if pos - f >= 0 + (f/2): l.insert(0, ("-" + r, pos - f))
+                if pos + f < count: l.append(("+" + r, pos + f))
+                if pos - f >= 0: l.insert(0, ("-" + r, pos - f))
 
             yield self.t("naventry", rev = 0, label="(0)")
                     
@@ -246,7 +246,7 @@
             parity = (start - end) & 1
             cl = self.repo.changelog
             l = [] # build a list in forward order for efficiency
-            for i in range(start, end + 1):
+            for i in range(start, end):
                 n = cl.node(i)
                 changes = cl.read(n)
                 hn = hex(n)
@@ -276,9 +276,9 @@
         cl = self.repo.changelog
         mf = cl.read(cl.tip())[0]
         count = cl.count()
-        end = min(pos, count - 1)
-        start = max(0, pos - self.maxchanges)
-        end = min(count - 1, start + self.maxchanges)
+        start = max(0, pos - self.maxchanges + 1)
+        end = min(count, start + self.maxchanges)
+        pos = end - 1
 
         yield self.t('changelog',
                      header = self.header(),
@@ -581,13 +581,12 @@
         self.t = templater(m, self.filters)
 
         if not args.has_key('cmd') or args['cmd'][0] == 'changelog':
-            hi = self.repo.changelog.count()
+            hi = self.repo.changelog.count() - 1
             if args.has_key('rev'):
                 hi = args['rev'][0]
                 try:
                     hi = self.repo.changelog.rev(self.repo.lookup(hi))
-                except KeyError:
-                    hi = self.repo.changelog.count()
+                except KeyError: pass
 
             write(self.changelog(hi))