branchmap: read return None in case of failure
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Sat, 22 Dec 2012 19:41:11 +0100
changeset 18212 493778b5fe9f
parent 18211 518c1403838f
child 18213 c38a62af000e
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.
mercurial/branchmap.py
--- 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