# HG changeset patch # User Pierre-Yves David # Date 1495019778 -7200 # Node ID 80d6a2ad7b116f7ca4b0f8c5b9bcb35b51e5eadc # Parent caddf846ca1eb91754431249cf8e73c41547e3c1 obshashcache: purge the meta line before writing a new one Otherwise we get multiple lines and this gets messy. diff -r caddf846ca1e -r 80d6a2ad7b11 hgext3rd/evolve/obsdiscovery.py --- 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()