mercurial/branchmap.py
branchstable
changeset 24159 5b4ed033390b
parent 23877 7cc77030c557
child 24163 bb11081562d7
--- a/mercurial/branchmap.py	Thu Feb 26 06:03:39 2015 +0900
+++ b/mercurial/branchmap.py	Fri Feb 06 02:52:10 2015 +0100
@@ -330,7 +330,7 @@
     and will grow with it but be 1/8th of its size.
     """
 
-    def __init__(self, repo):
+    def __init__(self, repo, readonly=True):
         assert repo.filtername is None
         self._names = [] # branch names in local encoding with static index
         self._rbcrevs = array('c') # structs of type _rbcrecfmt
@@ -342,6 +342,10 @@
         except (IOError, OSError), inst:
             repo.ui.debug("couldn't read revision branch cache names: %s\n" %
                           inst)
+            if readonly:
+                # don't try to use cache - fall back to the slow path
+                self.branchinfo = self._branchinfo
+
         if self._names:
             try:
                 data = repo.vfs.read(_rbcrevs)