Patchwork [16,of,22,V2-Series-D] hgweb: ignore filtered revision in revnav

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 14, 2013, 8:35 p.m.
Message ID <744fd7971957a6539a16.1358195748@yamac.lan>
Download mbox | patch
Permalink /patch/612/
State Superseded
Headers show

Comments

Pierre-Yves David - Jan. 14, 2013, 8:35 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@logilab.fr>
# Date 1357842863 -3600
# Node ID 744fd7971957a6539a1627dfed487052f2f0bc25
# Parent  814260dac17076a8c44b588a1968fdb2252e7520
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.cl:
+                continue
             if pos < rev < limit:
                 navafter.append(("+%d" % f, self.hex(rev)))
             if 0 < rev < pos:
                 navbefore.append(("-%d" % f, self.hex(rev)))