fix changenav for maxchanges != 10
for maxchanges = 25 the changelog navigation had a minimum
stepsize of 30; try to calculate more useful navigation steps
--- a/mercurial/hgweb.py Mon Feb 06 17:34:39 2006 -0600
+++ b/mercurial/hgweb.py Mon Feb 06 17:34:53 2006 -0600
@@ -298,19 +298,25 @@
def changelog(self, pos):
def changenav(**map):
- def seq(factor=1):
- yield 1 * factor
- yield 3 * factor
- #yield 5 * factor
+ def seq(factor, maxchanges=None):
+ if maxchanges:
+ yield maxchanges
+ if maxchanges >= 20 and maxchanges <= 40:
+ yield 50
+ else:
+ yield 1 * factor
+ yield 3 * factor
for f in seq(factor * 10):
yield f
l = []
- for f in seq():
- if f < self.maxchanges / 2:
+ last = 0
+ for f in seq(1, self.maxchanges):
+ if f < self.maxchanges or f <= last:
continue
if f > count:
break
+ last = f
r = "%d" % f
if pos + f < count:
l.append(("+" + r, pos + f))