Patchwork [12,of,15,V3] hgweb: ignore filtered revision in revnav

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 16, 2013, 1:32 p.m.
Message ID <f048717d6e8a5fb3fae5.1358343138@crater2.logilab.fr>
Download mbox | patch
Permalink /patch/648/
State Accepted
Delegated to: Kevin Bullock
Headers show

Comments

Pierre-Yves David - Jan. 16, 2013, 1:32 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1358342368 -3600
# Node ID f048717d6e8a5fb3fae5b2241e373cc72de27533
# Parent  b3a1ca0245d9d90b20d552229986825a3d062b75
hgweb: ignore filtered revision in revnav

This changeset checks that a revision is known before adding it to the
navigation.

This will prevent traceback on filtered repository. This changeset result in an
incorrect behaviors, Navigation link may be dropped without any replacement.
However this bad navigation generation is much better than a crash

Patch

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -86,10 +86,12 @@  class revnav(object):
         targets.sort()
 
         navbefore = [("(0)", self.hex(0))]
         navafter = []
         for rev in targets:
+            if rev not in self._revlog:
+                continue
             if pos < rev < limit:
                 navafter.append(("+%d" % f, self.hex(rev)))
             if 0 < rev < pos:
                 navbefore.append(("-%d" % f, self.hex(rev)))
 
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -660,14 +660,14 @@  check hgweb does not explode
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
   $ cat hg.pid >> $DAEMON_PIDS
 
-#check changelog view
-#
-#  $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'shortlog/' 
-#  200 Script output follows
+check changelog view
+
+  $ "$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