changeset 18212:493778b5fe9f

branchmap: read return None in case of failure This makes a clear distinction between having read a valid cache on disk or not. This will help caches of various filtering level to collaborate.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Sat, 22 Dec 2012 19:41:11 +0100
parents 518c1403838f
children c38a62af000e
files mercurial/branchmap.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/branchmap.py	Sat Dec 29 00:40:18 2012 +0100
+++ b/mercurial/branchmap.py	Sat Dec 22 19:41:11 2012 +0100
@@ -22,7 +22,7 @@
         lines = f.read().split('\n')
         f.close()
     except (IOError, OSError):
-        return branchcache()
+        return None
 
     try:
         cachekey = lines.pop(0).split(" ", 2)
@@ -53,7 +53,7 @@
                 msg += ' (%s)' % repo.filtername
             msg += ': %s\n'
             repo.ui.warn(msg % inst)
-        partial = branchcache()
+        partial = None
     return partial
 
 
@@ -65,6 +65,8 @@
 
     if partial is None or not partial.validfor(repo):
         partial = read(repo)
+        if partial is None:
+            partial = branchcache()
 
     catip = repo._cacheabletip()
     # if partial.tiprev == catip: cache is already up to date