Mercurial > evolve
changeset 2391:80d6a2ad7b11
obshashcache: purge the meta line before writing a new one
Otherwise we get multiple lines and this gets messy.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 17 May 2017 13:16:18 +0200 |
parents | caddf846ca1e |
children | 6be71b8f3408 |
files | hgext3rd/evolve/obsdiscovery.py |
diffstat | 1 files changed, 2 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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()