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

login
register
mail settings
Submitter Alexander Plavin
Date July 24, 2013, 10:55 p.m.
Message ID <ffc31746e340054563f3.1374706550@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/1954/
State Accepted
Commit 8cfa3a3664a5b9c5ec561df81516c1b19e690c7d
Headers show

Comments

Alexander Plavin - July 24, 2013, 10:55 p.m.
# HG changeset patch
# User Alexander Plavin <me@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.
Matt Mackall - July 25, 2013, 5:49 a.m.
On Thu, 2013-07-25 at 02:55 +0400, Alexander Plavin wrote:
> # HG changeset patch
> # User Alexander Plavin <me@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)

These are queued for stable, thanks.

Patch

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))