hgweb: ensure _navseq yield strictly increasing numbers
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Thu, 10 Jan 2013 18:52:17 +0100
changeset 18392 88a37b19dc0e
parent 18391 833eb34e90e4
child 18393 a38039ef7312
hgweb: ensure _navseq yield strictly increasing numbers This is not hard and allows to drop hack in the customer code.
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: