Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

stable csinfo: introduce the cache for configs

Changeset 9990598892ab

Parent 61f35d49e7e7

by Yuki KODAMA

Changes to one file · Browse files at 9990598892ab Showing diff from parent 61f35d49e7e7 Diff from another changeset...

 
245
246
247
248
 
249
250
251
 
259
260
261
262
 
263
264
265
 
372
373
374
375
 
376
377
378
 
413
414
415
 
 
 
 
 
 
 
 
 
 
416
417
 
418
419
420
 
245
246
247
 
248
249
250
251
 
259
260
261
 
262
263
264
265
 
372
373
374
 
375
376
377
378
 
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
@@ -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):