changeset 4415:1a63b44f90c9

branch.cache: silently ignore I/O and OS errors
author Matt Mackall <mpm@selenic.com>
date Tue, 08 May 2007 02:57:05 -0500
parents b6146466b92a
children bb1800a7d7e1
files mercurial/localrepo.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -401,6 +401,10 @@ class localrepository(repo.repository):
             f = self.opener("branch.cache")
             lines = f.read().split('\n')
             f.close()
+        except (IOError, OSError):
+            return {}, nullid, nullrev
+
+        try:
             last, lrev = lines.pop(0).split(" ", 1)
             last, lrev = bin(last), int(lrev)
             if not (lrev < self.changelog.count() and
@@ -426,7 +430,7 @@ class localrepository(repo.repository):
             for label, node in branches.iteritems():
                 f.write("%s %s\n" % (hex(node), label))
             f.rename()
-        except IOError:
+        except (IOError, OSError):
             pass
 
     def _updatebranchcache(self, partial, start, end):