branch.cache: silently ignore I/O and OS errors
authorMatt Mackall <mpm@selenic.com>
Tue, 08 May 2007 02:57:05 -0500
changeset 4415 1a63b44f90c9
parent 4414 b6146466b92a
child 4416 bb1800a7d7e1
branch.cache: silently ignore I/O and OS errors
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Mon May 07 22:30:36 2007 -0500
+++ b/mercurial/localrepo.py	Tue May 08 02:57:05 2007 -0500
@@ -401,6 +401,10 @@
             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 @@
             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):