diff hgext/evolve.py @ 539:9555231a66b2 stable

hgweb: disable branchtip filtering for hgweb hgweb make extensibe use of branchtip we should. - Our branchtip wrapping make the function expensive, killing performance. - We do not filter anything un hgweb yet.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Thu, 30 Aug 2012 21:47:09 +0200
parents 45ccaba212f9
children 8c5da9e75ae0
line wrap: on
line diff
--- a/hgext/evolve.py	Thu Aug 30 20:28:00 2012 +0200
+++ b/hgext/evolve.py	Thu Aug 30 21:47:09 2012 +0200
@@ -49,6 +49,8 @@
 from mercurial.commands import walkopts, commitopts, commitopts2
 from mercurial.node import nullid
 
+import mercurial.hgweb.hgweb_mod
+
 
 
 # This extension contains the following code
@@ -579,6 +581,8 @@
 @eh.wrapfunction(localrepo.localrepository, 'branchtip')
 def obsbranchtip(orig, repo, branch):
     """ensure "stable" reference does not end on a hidden changeset"""
+    if not getattr(repo, '_dofilterbranchtip', True):
+        return orig(repo, branch)
     result = ()
     heads = repo.branchmap().get(branch, ())
     if heads:
@@ -588,6 +592,13 @@
     return result[0].node()
 
 
+@eh.wrapfunction(mercurial.hgweb.hgweb_mod.hgweb, '__init__')
+@eh.wrapfunction(mercurial.hgweb.hgweb_mod.hgweb, 'refresh')
+def nofilter(orig, hgweb, *args, **kwargs):
+    orig(hgweb, *args, **kwargs)
+    hgweb.repo._dofilterbranchtip = False
+
+
 #####################################################################
 ### Additional Utilities                                          ###
 #####################################################################