changeset 18428:8c10f760ca34

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. Note that changelog.revs can not represents empty iteration like xrange did. So we have to explicitly prevent call when there is nothing to do.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 16 Jan 2013 14:22:43 +0100
parents 56ca4443a343
children e9ea0f0f05e7
files mercurial/hgweb/webcommands.py tests/test-obsolete.t
diffstat 2 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Fri Jan 11 01:08:00 2013 +0100
+++ b/mercurial/hgweb/webcommands.py	Wed Jan 16 14:22:43 2013 +0100
@@ -857,8 +857,11 @@
     downrev = max(0, rev - revcount)
     changenav = webutil.revnav(web.repo).gen(pos, revcount, count)
 
-    dag = graphmod.dagwalker(web.repo, range(start, end)[::-1])
-    tree = list(graphmod.colored(dag, web.repo))
+    tree = []
+    if start < end:
+        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
--- a/tests/test-obsolete.t	Fri Jan 11 01:08:00 2013 +0100
+++ b/tests/test-obsolete.t	Wed Jan 16 14:22:43 2013 +0100
@@ -684,15 +684,15 @@
   $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'shortlog/'
   200 Script output follows
 
-#check graph view
-#
-#  $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'graph'
-#  200 Script output follows
+check graph view
+
+  $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'graph'
+  200 Script output follows
+
 check filelog view
 
   $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'log/'`hg id --debug --id`/'babar'
   200 Script output follows
-
   $ kill `cat hg.pid`
 
 Checking _enable=False warning if obsolete marker exists