obscache: use 'nullid' as the hash of an empty obsstore
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 12 May 2017 19:04:13 +0200
changeset 2354 fed22455e510
parent 2353 393cbaf0d294
child 2355 078549a71ce4
obscache: use 'nullid' as the hash of an empty obsstore This align this result with what we use for 'emptykey'
hgext3rd/evolve/obscache.py
--- a/hgext3rd/evolve/obscache.py	Fri May 12 18:56:56 2017 +0200
+++ b/hgext3rd/evolve/obscache.py	Fri May 12 19:04:13 2017 +0200
@@ -79,7 +79,12 @@
             except (OSError, IOError) as e:
                 if e.errno != errno.ENOENT:
                     raise
-            key = hashlib.sha1(keydata).digest()
+            if keydata:
+                key = hashlib.sha1(keydata).digest()
+            else:
+                # reusing an existing "empty" value make it easier to define a
+                # default cachekey for 'no data'.
+                key = node.nullid
             return obsstoresize, key
 
     obsstore.__class__ = cachekeyobsstore