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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Jan 14 14:35:49 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at 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

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)))


More information about the Mercurial-devel mailing list