Patchwork [17,of,22,V2-Series-D] hgweb: protect filelog revnav from filtering related crash

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 14, 2013, 8:35 p.m.
Message ID <4725c0dc4949c12016ab.1358195749@yamac.lan>
Download mbox | patch
Permalink /patch/613/
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 1357843043 -3600
# Node ID 4725c0dc4949c12016abf6d9c60806defa6404e6
# Parent  744fd7971957a6539a1627dfed487052f2f0bc25
hgweb: protect filelog revnav from filtering related crash

As explained in 518c1403838f linkrev is broken with filtering. This changeset
use an unfiltered repo to retrieve any node from a link rev.

Like the previous changesets and 518c1403838f, This will prevent traceback on
filtered repository. This changeset result in an incorrect behaviors, Navigation
link may point to missing revision. However this bad navigation
generation is much better than a plain crash

Patch

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -109,11 +109,11 @@  class filerevnav(revnav):
 
         :repo: repo object we generate nav for
         :path: path of the file we generate nav for
         """
         # used for iteration
-        self._hl = repo.changelog
+        self._hl = repo.unfiltered().changelog
         # used for hex generation
         self.cl = repo.file(path)
 
     def hex(self, rev):
         return hex(self._hl.node(self.cl.linkrev(rev)))