obscache: set a valid "empty" cache key if the cache is missing
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Tue, 02 May 2017 16:17:03 +0200
changeset 2307 0d2e0e8e76f6
parent 2306 b33bc2f37e89
child 2308 ef8beb602b41
obscache: set a valid "empty" cache key if the cache is missing This avoid detecting bad cache when it just happens to be no cache.
hgext3rd/evolve/obscache.py
--- a/hgext3rd/evolve/obscache.py	Tue May 02 16:10:14 2017 +0200
+++ b/hgext3rd/evolve/obscache.py	Tue May 02 16:17:03 2017 +0200
@@ -82,6 +82,8 @@
 
     return obsstore
 
+emptykey = (node.nullrev, node.nullid, 0, 0, node.nullid)
+
 def getcachekey(repo):
     """get a cache key covering the changesets and obsmarkers content
 
@@ -314,6 +316,7 @@
 
         data = repo.vfs.tryread(self._filepath)
         if not data:
+            self._cachekey = emptykey
             return
 
         headersize = struct.calcsize(self._headerformat)