diff mercurial/localrepo.py @ 3761:9433bdcaa9ae

Ignore all errors while parsing the branch cache.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 02 Dec 2006 03:38:55 -0200
parents 9e67fecbfd16
children 73860ffbe798
line wrap: on
line diff
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -327,16 +327,20 @@ class localrepository(repo.repository):
             f.close()
             last, lrev = lines.pop(0).rstrip().split(" ", 1)
             last, lrev = bin(last), int(lrev)
-            if (lrev < self.changelog.count() and
-                self.changelog.node(lrev) == last): # sanity check
-                for l in lines:
-                    if not l: continue
-                    node, label = l.rstrip().split(" ", 1)
-                    partial[label] = bin(node)
-            else: # invalidate the cache
-                last, lrev = nullid, nullrev
-        except IOError:
-            last, lrev = nullid, nullrev
+            if not (lrev < self.changelog.count() and
+                    self.changelog.node(lrev) == last): # sanity check
+                # invalidate the cache
+                raise ValueError('Invalid branch cache: unknown tip')
+            for l in lines:
+                if not l: continue
+                node, label = l.rstrip().split(" ", 1)
+                partial[label] = bin(node)
+        except (KeyboardInterrupt, util.SignalInterrupt):
+            raise
+        except Exception, inst:
+            if self.ui.debugflag:
+                self.ui.warn(str(inst), '\n')
+            partial, last, lrev = {}, nullid, nullrev
         return partial, last, lrev
 
     def _writebranchcache(self, branches, tip, tiprev):