# HG changeset patch # User Pierre-Yves David # Date 1357840337 -3600 # Node ID 88a37b19dc0e482b7d6aec386c593a6fae370b96 # Parent 833eb34e90e422cc4bf5f2f9d491498911a6c553 hgweb: ensure _navseq yield strictly increasing numbers This is not hard and allows to drop hack in the customer code. diff -r 833eb34e90e4 -r 88a37b19dc0e mercurial/hgweb/webutil.py --- 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: