Mercurial > hg
changeset 1703:41d884f741ca
fix changenav for maxchanges != 10
for maxchanges = 25 the changelog navigation had a minimum
stepsize of 30; try to calculate more useful navigation steps
author | Johannes Stezenbach <js@linuxtv.org> |
---|---|
date | Mon, 06 Feb 2006 17:34:53 -0600 |
parents | e291d9a30bef |
children | c2755eba8631 |
files | mercurial/hgweb.py |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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))