Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

csinfo: remove cache mechanism

Changeset 7ec08aebefb6

Parent fb14d984fbce

by Yuki KODAMA

Changes to one file · Browse files at 7ec08aebefb6 Showing diff from parent fb14d984fbce Diff from another changeset...

 
55
56
57
58
 
59
60
61
 
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
 
547
548
549
550
551
552
553
554
555
556
557
558
559
 
55
56
57
 
58
59
60
61
 
413
414
415
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
417
418
 
499
500
501
 
 
 
 
 
 
 
502
503
504
@@ -55,7 +55,7 @@
  if style is None:   style = panelstyle()   self.csstyle = style - self.info = CachedSummaryInfo() + self.info = SummaryInfo()     self.withupdate = withupdate   @@ -413,54 +413,6 @@
  pass   return default_func(widget, item, markups)   -class CachedSummaryInfo(SummaryInfo): - - def __init__(self): - SummaryInfo.__init__(self) - self.clear_cache() - - def try_cache(self, target, func, *args, **kargs): - item, widget, ctx, custom = args - if target != 'widget': # no cache for widget - root = ctx._repo.root - repoid = id(ctx._repo) - try: - cacheinfo = self.cache[root] - if cacheinfo[0] != repoid: - del self.cache[root] # clear cache - cacheinfo = None - except KeyError: - cacheinfo = None - if cacheinfo is None: - self.cache[root] = cacheinfo = (repoid, {}) - revid = ctx.hex() - if not revid and hasattr(ctx, '_path'): - revid = ctx._path - key = target + item + revid + str(custom) - try: - return cacheinfo[1][key] - except KeyError: - pass - value = func(self, *args, **kargs) - if target != 'widget': # do not cache widgets - cacheinfo[1][key] = value - return value - - def get_data(self, *args, **kargs): - return self.try_cache('data', SummaryInfo.get_data, *args, **kargs) - - def get_label(self, *args, **kargs): - return self.try_cache('label', SummaryInfo.get_label, *args, **kargs) - - def get_markup(self, *args, **kargs): - return self.try_cache('markup', SummaryInfo.get_markup, *args, **kargs) - - def get_widget(self, *args, **kargs): - return self.try_cache('widget', SummaryInfo.get_widget, *args, **kargs) - - def clear_cache(self): - self.cache = {} -  class SummaryBase(object):     def __init__(self, target, custom, repo, info): @@ -547,13 +499,6 @@
 # self.set_label(label)  # self.set_shadow_type(gtk.SHADOW_ETCHED_IN)   -# if 'padding' in self.csstyle: -# padding = self.csstyle['padding'] - # 'border' range is 0-65535 -# assert isinstance(padding, (int, long)) -# assert 0 <= padding and padding <= 65535 -# self.table.set_border_width(padding) -   # build info   contents = self.csstyle.get('contents', ())