changeset 2394:1b3a797c4586

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 17 May 2017 14:40:18 +0200
parents 2a194fe1a557
children 5774c27ce927
files hgext3rd/evolve/obsdiscovery.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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):