[PATCH 3 of 3] hgweb: fix incorrect revisions count in graph (issue3977)

Alexander Plavin me at aplavin.ru
Wed Jul 24 22:55:50 UTC 2013


# HG changeset patch
# User Alexander Plavin <me at aplavin.ru>
# Date 1374705682 -14400
#      Thu Jul 25 02:41:22 2013 +0400
# Branch stable
# Node ID ffc31746e340054563f39f18f1ca2d8dda042f77
# Parent  36763959301fcede6b0118ae61f4c99e4048bbf8
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.

diff -r 36763959301f -r ffc31746e340 mercurial/hgweb/webcommands.py
--- 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))
 



More information about the Mercurial-devel mailing list