--- a/hgext3rd/evolve/obsdiscovery.py Mon Aug 27 11:40:32 2018 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py Mon Aug 27 12:12:49 2018 +0200
@@ -609,9 +609,12 @@
for req in _sqliteschema:
con.execute(req)
- con.execute(_newmeta, self._fullcachekey)
+ meta = [self._schemaversion] + list(self.emptykey)
+ con.execute(_newmeta, meta)
+ self._ondiskcachekey = self.emptykey
else:
con = self._con
+ with con:
meta = con.execute(_querymeta).fetchone()
if meta[1:] != self._ondiskcachekey:
# drifting is currently an issue because this means another
@@ -620,17 +623,20 @@
msg = _('obshashrange cache: skipping write, '
'database drifted under my feet\n')
repo.ui.warn(msg)
+ self._new.clear()
+ self._valid = False
+ if '_con' in vars(self):
+ del self._con
+ self._valid = False
return
- data = ((rangeid[0], rangeid[1], self.get(rangeid)) for rangeid in self._new)
- con.executemany(_updateobshash, data)
- cachekey = self._fullcachekey
- con.execute(_clearmeta) # remove the older entry
- con.execute(_newmeta, cachekey)
- con.commit()
- self._new.clear()
- self._ondiskcachekey = self._cachekey
- self._valid = True
-
+ data = ((rangeid[0], rangeid[1], self.get(rangeid)) for rangeid in self._new)
+ con.executemany(_updateobshash, data)
+ cachekey = self._fullcachekey
+ con.execute(_clearmeta) # remove the older entry
+ con.execute(_newmeta, cachekey)
+ self._new.clear()
+ self._valid = True
+ self._ondiskcachekey = self._cachekey
@eh.wrapfunction(obsolete.obsstore, '_addmarkers')
def _addmarkers(orig, obsstore, *args, **kwargs):
obsstore.rangeobshashcache.clear()