changeset 19487:8cfa3a3664a5 stable

hgweb: fix incorrect revisions count in graph (issue3977) Actual amount of revisions is used now instead of their numbers in the repo before to deal with skipped numbers correctly.
author Alexander Plavin <me@aplavin.ru>
date Thu, 25 Jul 2013 02:41:22 +0400
parents 002b711a3e8a
children 60e060f4faa9
files mercurial/hgweb/webcommands.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Thu Jul 25 02:22:39 2013 +0400
+++ b/mercurial/hgweb/webcommands.py	Thu Jul 25 02:41:22 2013 +0400
@@ -875,16 +875,20 @@
 
     count = len(web.repo)
     pos = rev
-    start = max(0, pos - revcount + 1)
-    end = pos + 1
 
     uprev = min(max(0, count - 1), rev + revcount)
     downrev = max(0, rev - revcount)
     changenav = webutil.revnav(web.repo).gen(pos, revcount, count)
 
     tree = []
-    if start < end:
-        revs = list(web.repo.changelog.revs(end - 1, start))
+    if pos != -1:
+        allrevs = web.repo.changelog.revs(pos, 0)
+        revs = []
+        for i in allrevs:
+            revs.append(i)
+            if len(revs) >= revcount:
+                break
+
         dag = graphmod.dagwalker(web.repo, revs)
         tree = list(graphmod.colored(dag, web.repo))