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.
--- 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