equal
deleted
inserted
replaced
221 # in memory caching of the value |
221 # in memory caching of the value |
222 cache[rangeid] = value |
222 cache[rangeid] = value |
223 except (sqlite3.DatabaseError, sqlite3.OperationalError): |
223 except (sqlite3.DatabaseError, sqlite3.OperationalError): |
224 # something is wrong with the sqlite db |
224 # something is wrong with the sqlite db |
225 # Since this is a cache, we ignore it. |
225 # Since this is a cache, we ignore it. |
226 if '_con' in vars(self): |
226 if r'_con' in vars(self): |
227 del self._con |
227 del self._con |
228 self._unsavedsubranges.clear() |
228 self._unsavedsubranges.clear() |
229 |
229 |
230 return cache.get(rangeid) |
230 return cache.get(rangeid) |
231 |
231 |
276 except (IOError, OSError, sqlite3.DatabaseError, sqlite3.OperationalError, sqlite3.IntegrityError) as exc: |
276 except (IOError, OSError, sqlite3.DatabaseError, sqlite3.OperationalError, sqlite3.IntegrityError) as exc: |
277 # Catch error that may arise under stress |
277 # Catch error that may arise under stress |
278 # |
278 # |
279 # operational error catch read-only and locked database |
279 # operational error catch read-only and locked database |
280 # IntegrityError catch Unique constraint error that may arise |
280 # IntegrityError catch Unique constraint error that may arise |
281 if '_con' in vars(self): |
281 if r'_con' in vars(self): |
282 del self._con |
282 del self._con |
283 self._unsavedsubranges.clear() |
283 self._unsavedsubranges.clear() |
284 repo.ui.log('evoext-cache', 'error while saving new data: %s' % exc) |
284 repo.ui.log('evoext-cache', 'error while saving new data: %s' % exc) |
285 repo.ui.debug('evoext-cache: error while saving new data: %s' % exc) |
285 repo.ui.debug('evoext-cache: error while saving new data: %s' % exc) |
286 |
286 |
292 if not self._unsavedsubranges: |
292 if not self._unsavedsubranges: |
293 return # no new data |
293 return # no new data |
294 |
294 |
295 if self._con is None: |
295 if self._con is None: |
296 util.unlinkpath(self._path, ignoremissing=True) |
296 util.unlinkpath(self._path, ignoremissing=True) |
297 if '_con' in vars(self): |
297 if r'_con' in vars(self): |
298 del self._con |
298 del self._con |
299 |
299 |
300 con = self._db() |
300 con = self._db() |
301 if con is None: |
301 if con is None: |
302 return |
302 return |
373 def _tipnode(self, value): |
373 def _tipnode(self, value): |
374 self._cachekey = (self._cachekey[0], value) |
374 self._cachekey = (self._cachekey[0], value) |
375 |
375 |
376 def clear(self, reset=False): |
376 def clear(self, reset=False): |
377 super(stablerangesql, self).clear(reset=reset) |
377 super(stablerangesql, self).clear(reset=reset) |
378 if '_con' in vars(self): |
378 if r'_con' in vars(self): |
379 del self._con |
379 del self._con |
380 self._subrangescache.clear() |
380 self._subrangescache.clear() |
381 |
381 |
382 def load(self, repo): |
382 def load(self, repo): |
383 """load data from disk""" |
383 """load data from disk""" |
434 cache.update(self) |
434 cache.update(self) |
435 return cache |
435 return cache |
436 |
436 |
437 @localrepo.unfilteredmethod |
437 @localrepo.unfilteredmethod |
438 def destroyed(self): |
438 def destroyed(self): |
439 if 'stablerange' in vars(self): |
439 if r'stablerange' in vars(self): |
440 self.stablerange.clear() |
440 self.stablerange.clear() |
441 del self.stablerange |
441 del self.stablerange |
442 super(stablerangerepo, self).destroyed() |
442 super(stablerangerepo, self).destroyed() |
443 |
443 |
444 @localrepo.unfilteredmethod |
444 @localrepo.unfilteredmethod |