# HG changeset patch # User Pierre-Yves David # Date 1494927465 -7200 # Node ID 2a1aad0fd8bf186768a1d42ca5dbbb2804b935c4 # Parent a0099d568ef810910ed72394efaa234a8230b5ff obshashrange: stop inheriting from 'dict' A simple dictionary attribute seems more simpler. diff -r a0099d568ef8 -r 2a1aad0fd8bf hgext3rd/evolve/obsdiscovery.py --- 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)