equal
deleted
inserted
replaced
435 try: |
435 try: |
436 obshash = self._con.execute(_queryobshash, nrange).fetchone() |
436 obshash = self._con.execute(_queryobshash, nrange).fetchone() |
437 if obshash is not None: |
437 if obshash is not None: |
438 value = obshash[0] |
438 value = obshash[0] |
439 self._data[rangeid] = value |
439 self._data[rangeid] = value |
440 except sqlite3.OperationalError: |
440 except (sqlite3.DatabaseError, sqlite3.OperationalError): |
441 # something is wrong with the sqlite db |
441 # something is wrong with the sqlite db |
442 # Since this is a cache, we ignore it. |
442 # Since this is a cache, we ignore it. |
443 if '_con' in vars(self): |
443 if '_con' in vars(self): |
444 del self._con |
444 del self._con |
445 self._new.clear() |
445 self._new.clear() |
487 else: |
487 else: |
488 ranges = repo.stablerange.contains(repo, affected) |
488 ranges = repo.stablerange.contains(repo, affected) |
489 con.executemany(_delete, ranges) |
489 con.executemany(_delete, ranges) |
490 for r in ranges: |
490 for r in ranges: |
491 self._data.pop(r, None) |
491 self._data.pop(r, None) |
492 except sqlite3.OperationalError as exc: |
492 except (sqlite3.DatabaseError, sqlite3.OperationalError) as exc: |
493 repo.ui.log('evoext-cache', 'error while updating obshashrange cache: %s' % exc) |
493 repo.ui.log('evoext-cache', 'error while updating obshashrange cache: %s' % exc) |
494 del self._updating |
494 del self._updating |
495 return |
495 return |
496 |
496 |
497 # rewarm key revisions |
497 # rewarm key revisions |
582 def _save(self, repo): |
582 def _save(self, repo): |
583 if not self._new: |
583 if not self._new: |
584 return |
584 return |
585 try: |
585 try: |
586 return self._trysave(repo) |
586 return self._trysave(repo) |
587 except (sqlite3.OperationalError, sqlite3.IntegrityError) as exc: |
587 except (sqlite3.DatabaseError, sqlite3.OperationalError, sqlite3.IntegrityError) as exc: |
588 # Catch error that may arise under stress |
588 # Catch error that may arise under stress |
589 # |
589 # |
590 # operational error catch read-only and locked database |
590 # operational error catch read-only and locked database |
591 # IntegrityError catch Unique constraint error that may arise |
591 # IntegrityError catch Unique constraint error that may arise |
592 if '_con' in vars(self): |
592 if '_con' in vars(self): |