changeset 2354:fed22455e510

obscache: use 'nullid' as the hash of an empty obsstore This align this result with what we use for 'emptykey'
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 12 May 2017 19:04:13 +0200
parents 393cbaf0d294
children 078549a71ce4
files hgext3rd/evolve/obscache.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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