~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/changecache.py

  • Committer: Martin Pool
  • Date: 2011-11-25 02:28:56 UTC
  • mto: This revision was merged to the branch mainline in revision 461.
  • Revision ID: mbp@canonical.com-20111125022856-7ke5b3jqo255n214
Slight split out of common fixture code for loggerhead tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
            pass
100
100
 
101
101
 
102
 
class FileChangeCache(object):
103
 
 
104
 
    def __init__(self, cache_path):
105
 
 
106
 
        if not os.path.exists(cache_path):
107
 
            os.mkdir(cache_path)
108
 
 
109
 
        self._changes_filename = os.path.join(cache_path, 'filechanges.sql')
110
 
 
111
 
    def get_file_changes(self, entry):
112
 
        cache = FakeShelf(self._changes_filename)
113
 
        changes = cache.get(entry.revid)
114
 
        if changes is None:
115
 
            changes = self.history.get_file_changes_uncached(entry)
116
 
            cache.add(entry.revid, changes)
117
 
        return changes
118
 
 
119
 
 
120
102
class RevInfoDiskCache(object):
121
103
    """Like `RevInfoMemoryCache` but backed in a sqlite DB."""
122
104