Patchwork [04,of,23,Series-D] hgweb: walk the graph through the changelog

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 11, 2013, 12:23 a.m.
Message ID <850eaea6a6e3a137b1df.1357863829@yamac.lan>
Download mbox | patch
Permalink /patch/525/
State Superseded
Headers show

Comments

Pierre-Yves David - Jan. 11, 2013, 12:23 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1357854142 -3600
# Node ID 850eaea6a6e3a137b1df2b59ae1c9714e8d5999f
# Parent  98f9b2c7ca0e28e657fd93d298d24ef3ad8810c2
hgweb: walk the graph through the changelog

This is necessary to enforce filtering. The result is a bit buggy (may provide
less changeset than expected, but it will stop crashing on filtered revision
access.

Patch

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -852,11 +852,12 @@  def graph(web, req, tmpl):
     downrev = max(0, rev - revcount)
     changenav = webutil.revnavgen(pos, revcount, count, web.repo.changectx)
 
     tree = []
     if start < end:
-        dag = graphmod.dagwalker(web.repo, range(start, end)[::-1])
+        revs = list(web.repo.changelog.revs(end - 1, start))
+        dag = graphmod.dagwalker(web.repo, revs)
         tree = list(graphmod.colored(dag, web.repo))
 
     def getcolumns(tree):
         cols = 0
         for (id, type, ctx, vtx, edges) in tree: