diff mercurial/localrepo.py @ 3452:fcf14d87e0a4

If we can't write the branch cache, fail quietly.
author Matt Mackall <mpm@selenic.com>
date Wed, 18 Oct 2006 10:46:51 -0500
parents 27ebe4efe98e
children 0e68608bd11d dba3cadef789
line wrap: on
line diff
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -322,11 +322,14 @@ class localrepository(repo.repository):
         return self.branchcache
 
     def _writebranchcache(self):
-        f = self.opener("branches.cache", "w")
-        t = self.changelog.tip()
-        f.write("%s %s\n" % (hex(t), self.changelog.count() - 1))
-        for label, node in self.branchcache.iteritems():
-            f.write("%s %s\n" % (hex(node), label))
+        try:
+            f = self.opener("branches.cache", "w")
+            t = self.changelog.tip()
+            f.write("%s %s\n" % (hex(t), self.changelog.count() - 1))
+            for label, node in self.branchcache.iteritems():
+                f.write("%s %s\n" % (hex(node), label))
+        except IOError:
+            pass
 
     def lookup(self, key):
         if key == '.':