diff mercurial/hgweb/webutil.py @ 19093:6f27efc7db23 stable

hgweb: fix empty navigation detection For some obscure reason, changelog.node(0) returns nullid if changelog is empty. this break empty navigation detection. We fix this code by using the length of the changelog. Using the length have some issue with revision filtering but this is a small step in the right direction. Proper fix comes in later changeset.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 30 Apr 2013 15:11:12 +0200
parents 7f769d3a8ad2
children fc1b77db123f
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py	Tue Apr 30 14:56:33 2013 +0100
+++ b/mercurial/hgweb/webutil.py	Tue Apr 30 15:11:12 2013 +0200
@@ -51,11 +51,7 @@
 
     def __nonzero__(self):
         """return True if any revision to navigate over"""
-        try:
-            self._revlog.node(0)
-            return True
-        except error.RepoError:
-            return False
+        return bool(len(self._revlog))
 
     def hex(self, rev):
         return hex(self._revlog.node(rev))