obshashrange: cleanup 'valid' life cycle
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 17 May 2017 14:40:18 +0200
changeset 2394 1b3a797c4586
parent 2393 2a194fe1a557
child 2395 5774c27ce927
obshashrange: cleanup 'valid' life cycle - reset is only called when we detect a strip, the on disk data are invalid, - after a reset, we should not keep using the data base connection, - after a write, the on disk data are valid.
hgext3rd/evolve/obsdiscovery.py
--- a/hgext3rd/evolve/obsdiscovery.py	Wed May 17 12:27:13 2017 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py	Wed May 17 14:40:18 2017 +0200
@@ -437,7 +437,9 @@
         super(_obshashcache, self).clear(reset=reset)
         self._data.clear()
         self._new.clear()
-        if not reset and '_con' in vars(self):
+        if reset:
+            self._valid = False
+        if '_con' in vars(self):
             del self._con
 
     def get(self, rangeid):
@@ -592,6 +594,7 @@
         con.commit()
         self._new.clear()
         self._ondiskcachekey = self._cachekey
+        self._valid = True
 
 @eh.wrapfunction(obsolete.obsstore, '_addmarkers')
 def _addmarkers(orig, obsstore, *args, **kwargs):