Mercurial > hg
changeset 18392:88a37b19dc0e
hgweb: ensure _navseq yield strictly increasing numbers
This is not hard and allows to drop hack in the customer code.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Thu, 10 Jan 2013 18:52:17 +0100 |
parents | 833eb34e90e4 |
children | a38039ef7312 |
files | mercurial/hgweb/webutil.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py Thu Jan 10 18:47:48 2013 +0100 +++ b/mercurial/hgweb/webutil.py Thu Jan 10 18:52:17 2013 +0100 @@ -28,8 +28,12 @@ if firststep: yield firststep if firststep >= 20 and firststep <= 40: - yield 50 - step *= 10 + firststep = 50 + yield firststep + assert step > 0 + assert firststep > 0 + while step <= firststep: + step *= 10 while True: yield 1 * step yield 3 * step @@ -53,13 +57,9 @@ navbefore = [] navafter = [] - last = 0 for f in _navseq(1, pagelen): - if f < pagelen or f <= last: - continue if f > limit: break - last = f if pos + f < limit: navafter.append(("+%d" % f, hex(nodefunc(pos + f).node()))) if pos - f >= 0: