equal
deleted
inserted
replaced
139 # - obsstore-file-size (in bytes), |
139 # - obsstore-file-size (in bytes), |
140 # - obsstore "cache key" |
140 # - obsstore "cache key" |
141 emptykey = (node.nullrev, node.nullid, 0, 0, node.nullid) |
141 emptykey = (node.nullrev, node.nullid, 0, 0, node.nullid) |
142 |
142 |
143 def __init__(self): |
143 def __init__(self): |
|
144 super(dualsourcecache, self).__init__() |
144 self._cachekey = None |
145 self._cachekey = None |
145 |
146 |
146 def _updatefrom(self, repo, revs, obsmarkers): |
147 def _updatefrom(self, repo, revs, obsmarkers): |
147 """override this method to update your cache data incrementally |
148 """override this method to update your cache data incrementally |
148 |
149 |
158 recomputed. |
159 recomputed. |
159 """ |
160 """ |
160 # /!\ IMPORTANT /!\ |
161 # /!\ IMPORTANT /!\ |
161 # You must overide this method to actually |
162 # You must overide this method to actually |
162 self._cachekey = self.emptykey if reset else None |
163 self._cachekey = self.emptykey if reset else None |
|
164 s = super(dualsourcecache, self) |
|
165 if util.safehasattr(s, 'clear') and callable(s.clear): |
|
166 s.clear() |
|
167 |
|
168 def load(self, repo): |
|
169 """Load data from disk |
|
170 |
|
171 Do not forget to restore the "cachekey" attribute while doing so. |
|
172 """ |
|
173 raise NotImplementedError |
163 |
174 |
164 # Useful public function (no need to override them) |
175 # Useful public function (no need to override them) |
165 |
176 |
166 def uptodate(self, repo): |
177 def uptodate(self, repo): |
167 """return True if the cache content is up to date False otherwise |
178 """return True if the cache content is up to date False otherwise |
178 |
189 |
179 def update(self, repo): |
190 def update(self, repo): |
180 """update the cache with new repository data |
191 """update the cache with new repository data |
181 |
192 |
182 The update will be incremental when possible""" |
193 The update will be incremental when possible""" |
|
194 repo = repo.unfiltered() |
183 # If we do not have any data, try loading from disk |
195 # If we do not have any data, try loading from disk |
184 if self._cachekey is None: |
196 if self._cachekey is None: |
185 self.load(repo) |
197 self.load(repo) |
186 |
198 |
187 assert repo.filtername is None |
199 assert repo.filtername is None |