Mercurial > evolve
changeset 2373:2a1aad0fd8bf
obshashrange: stop inheriting from 'dict'
A simple dictionary attribute seems more simpler.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 16 May 2017 11:37:45 +0200 |
parents | a0099d568ef8 |
children | 6308a8c04cce |
files | hgext3rd/evolve/obsdiscovery.py |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/obsdiscovery.py Wed May 17 09:52:06 2017 +0200 +++ b/hgext3rd/evolve/obsdiscovery.py Tue May 16 11:37:45 2017 +0200 @@ -416,7 +416,7 @@ _reset = "DELETE FROM obshashrange;" -class _obshashcache(obscache.dualsourcecache, dict): +class _obshashcache(obscache.dualsourcecache): _schemaversion = 1 @@ -428,6 +428,7 @@ self._repo = weakref.ref(repo.unfiltered()) # cache status self._ondiskcachekey = None + self._data = {} def clear(self, reset=False): self._valid = False @@ -436,6 +437,7 @@ if con is not None: con.execute(_reset) super(_obshashcache, self).clear(reset=reset) + self._data.clear() self._new.clear() if not reset and '_con' in vars(self): del self._con @@ -448,7 +450,7 @@ if not getattr(self, '_updating', False): assert rangeid[0] <= self._cachekey[0] - value = super(_obshashcache, self).get(rangeid) + value = self._data.get(rangeid) if value is None and self._con is not None: nrange = (rangeid[0], rangeid[1]) obshash = self._con.execute(_queryobshash, nrange).fetchone() @@ -458,7 +460,7 @@ def __setitem__(self, rangeid, obshash): self._new.add(rangeid) - super(_obshashcache, self).__setitem__(rangeid, obshash) + self._data[rangeid] = obshash def _updatefrom(self, repo, revs, obsmarkers): """override this method to update your cache data incrementally @@ -574,7 +576,7 @@ data = (meta[2], meta[1], self._ondiskcachekey[0], self._ondiskcachekey[1]) repo.ui.warn(msg) return - data = ((rangeid[0], rangeid[1], self[rangeid]) for rangeid in self._new) + data = ((rangeid[0], rangeid[1], self.get(rangeid)) for rangeid in self._new) con.executemany(_updateobshash, data) cachekey = self._fullcachekey con.execute(_newmeta, cachekey)