obshashcache: purge the meta line before writing a new one
Otherwise we get multiple lines and this gets messy.
--- a/hgext3rd/evolve/obsdiscovery.py Wed May 17 13:14:50 2017 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py Wed May 17 13:16:18 2017 +0200
@@ -408,6 +408,7 @@
"CREATE INDEX range_index ON obshashrange(rev, idx);",
]
_queryexist = "SELECT name FROM sqlite_master WHERE type='table' AND name='meta';"
+_clearmeta = """DELETE FROM meta;"""
_newmeta = """INSERT INTO meta (schemaversion, tiprev, tipnode, nbobsmarker, obssize, obskey)
VALUES (?,?,?,?,?,?);"""
_updateobshash = "INSERT INTO obshashrange(rev, idx, obshash) VALUES (?,?,?);"
@@ -585,6 +586,7 @@
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()