# HG changeset patch # User Yuki KODAMA <endflow....@gmail.com> # Date 1256375146 -32400 # Branch stable # Node ID 9990598892ab1501bd9012b42d894d5c9a471153 # Parent 61f35d49e7e7ac49dbd983166861affc077bf163 csinfo: introduce the cache for configs
diff --git a/tortoisehg/hgtk/csinfo.py b/tortoisehg/hgtk/csinfo.py --- a/tortoisehg/hgtk/csinfo.py +++ b/tortoisehg/hgtk/csinfo.py @@ -245,7 +245,7 @@ repo = ctx._repo if ctx.node() not in repo.branchtags().values(): return None - dblist = repo.ui.config('tortoisehg', 'deadbranch', '') + dblist = self.get_config(repo, 'tortoisehg', 'deadbranch') if dblist and value in [hglib.toutf(b.strip()) \ for b in dblist.split(',')]: return None @@ -259,7 +259,7 @@ value = self.get_data('rawtags', *args) if value: repo = ctx._repo - htags = repo.ui.config('tortoisehg', 'hidetags', '') + htags = self.get_config(repo, 'tortoisehg', 'hidetags', '') htags = [hglib.toutf(b.strip()) for b in htags.split()] value = [tag for tag in value if tag not in htags] if len(value) == 0: @@ -372,7 +372,7 @@ def __init__(self): SummaryInfo.__init__(self) - self.cache = {} + self.clear_cache() def try_cache(self, target, func, *args, **kargs): item, widget, ctx, custom = args @@ -413,8 +413,19 @@ def get_widget(self, *args, **kargs): return self.try_cache('widget', SummaryInfo.get_widget, *args, **kargs) + def get_config(self, repo, section, key, default=None, untrusted=False): + cachekey = repo.root + section + key + try: + return self.confcache[cachekey] + except KeyError: + pass + value = repo.ui.config(section, key, default, untrusted) + self.confcache[cachekey] = value + return value + def clear_cache(self): self.cache = {} + self.confcache = {} class SummaryBase(object):
thg-kuy_rev4747.patch
Description: Binary data
------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference
_______________________________________________ Tortoisehg-develop mailing list Tortoisehg-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop