Patchwork [stable?,v2] hgweb: have graphlog show revcount revs with filtered changes (issue3977)

login
register
mail settings
Submitter Augie Fackler
Date July 25, 2013, 12:40 a.m.
Message ID <938074a25cb0db01c1a3.1374712821@augie-macbookair>
Download mbox | patch
Permalink /patch/1956/
State Superseded, archived
Headers show

Comments

Augie Fackler - July 25, 2013, 12:40 a.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1374712814 14400
#      Wed Jul 24 20:40:14 2013 -0400
# Branch stable
# Node ID 938074a25cb0db01c1a31af5f80556750774649b
# Parent  10a0ae668fe62418b89fc58da26b0f40172266b2
hgweb: have graphlog show revcount revs with filtered changes (issue3977)

Without this change, specifying revcount= on a /graph page on hgweb
didn't correctly handle filtered revisions.
Augie Fackler - July 25, 2013, 12:41 a.m.
aaaand now I check email. It looks like aplavin may have a better solution, which I'll review in a bit.

On Jul 24, 2013, at 5:40 PM, Augie Fackler <raf@durin42.com> wrote:

> # HG changeset patch
> # User Augie Fackler <raf@durin42.com>
> # Date 1374712814 14400
> #      Wed Jul 24 20:40:14 2013 -0400
> # Branch stable
> # Node ID 938074a25cb0db01c1a31af5f80556750774649b
> # Parent  10a0ae668fe62418b89fc58da26b0f40172266b2
> hgweb: have graphlog show revcount revs with filtered changes (issue3977)
> 
> Without this change, specifying revcount= on a /graph page on hgweb
> didn't correctly handle filtered revisions.
> 
> diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
> --- a/mercurial/hgweb/webcommands.py
> +++ b/mercurial/hgweb/webcommands.py
> @@ -888,7 +888,12 @@
> 
>     tree = []
>     if start < end:
> -        revs = list(web.repo.changelog.revs(end - 1, start))
> +        revs = []
> +        while len(revs) < revcount and start >= 0:
> +            revs[-1:-1] = list(web.repo.changelog.revs(end - 1, start))
> +            end = start
> +            start -= revcount
> +        revs = revs[:revcount]
>         dag = graphmod.dagwalker(web.repo, revs)
>         tree = list(graphmod.colored(dag, web.repo))
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -888,7 +888,12 @@ 
 
     tree = []
     if start < end:
-        revs = list(web.repo.changelog.revs(end - 1, start))
+        revs = []
+        while len(revs) < revcount and start >= 0:
+            revs[-1:-1] = list(web.repo.changelog.revs(end - 1, start))
+            end = start
+            start -= revcount
+        revs = revs[:revcount]
         dag = graphmod.dagwalker(web.repo, revs)
         tree = list(graphmod.colored(dag, web.repo))