comparison 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
comparison
equal deleted inserted replaced
538:63fd2a62cec4 539:9555231a66b2
46 from mercurial import scmutil 46 from mercurial import scmutil
47 from mercurial import templatekw 47 from mercurial import templatekw
48 from mercurial.i18n import _ 48 from mercurial.i18n import _
49 from mercurial.commands import walkopts, commitopts, commitopts2 49 from mercurial.commands import walkopts, commitopts, commitopts2
50 from mercurial.node import nullid 50 from mercurial.node import nullid
51
52 import mercurial.hgweb.hgweb_mod
51 53
52 54
53 55
54 # This extension contains the following code 56 # This extension contains the following code
55 # 57 #
577 return orig(repo, node, *args, **kwargs) 579 return orig(repo, node, *args, **kwargs)
578 580
579 @eh.wrapfunction(localrepo.localrepository, 'branchtip') 581 @eh.wrapfunction(localrepo.localrepository, 'branchtip')
580 def obsbranchtip(orig, repo, branch): 582 def obsbranchtip(orig, repo, branch):
581 """ensure "stable" reference does not end on a hidden changeset""" 583 """ensure "stable" reference does not end on a hidden changeset"""
584 if not getattr(repo, '_dofilterbranchtip', True):
585 return orig(repo, branch)
582 result = () 586 result = ()
583 heads = repo.branchmap().get(branch, ()) 587 heads = repo.branchmap().get(branch, ())
584 if heads: 588 if heads:
585 result = list(repo.set('last(heads(branch(%n) - hidden()))', heads[0])) 589 result = list(repo.set('last(heads(branch(%n) - hidden()))', heads[0]))
586 if not result: 590 if not result:
587 raise error.RepoLookupError(_("unknown branch '%s'") % branch) 591 raise error.RepoLookupError(_("unknown branch '%s'") % branch)
588 return result[0].node() 592 return result[0].node()
593
594
595 @eh.wrapfunction(mercurial.hgweb.hgweb_mod.hgweb, '__init__')
596 @eh.wrapfunction(mercurial.hgweb.hgweb_mod.hgweb, 'refresh')
597 def nofilter(orig, hgweb, *args, **kwargs):
598 orig(hgweb, *args, **kwargs)
599 hgweb.repo._dofilterbranchtip = False
589 600
590 601
591 ##################################################################### 602 #####################################################################
592 ### Additional Utilities ### 603 ### Additional Utilities ###
593 ##################################################################### 604 #####################################################################